Lines Matching defs:tree
34 Dtlink_t* root; /* tree root */
43 Dttree_t *tree = (Dttree_t*)dt->data;
45 if(!here && !(here = tree->root) )
96 Dttree_t *tree = (Dttree_t*)dt->data;
98 if(!(root = tree->root) )
109 tree->root = root;
124 Dttree_t *tree = (Dttree_t*)dt->data;
126 root = tree->root;
127 tree->root = NIL(Dtlink_t*);
128 tree->data.size = 0;
153 Dttree_t *tree = (Dttree_t*)dt->data;
157 { if((list = tree->root) )
168 tree->root = list;
170 { tree->root = NIL(Dtlink_t*);
187 #if __STD_C /* compute tree depth and number of nodes */
234 Dttree_t *tree = (Dttree_t*)dt->data;
240 size = tsize(tree->root, 0, st);
249 #if __STD_C /* make a list into a balanced tree */
276 Dttree_t *tree = (Dttree_t*)dt->data;
281 tree->root = tbalance(list, size);
406 Dttree_t *tree = (Dttree_t*)dt->data;
421 { toptimize(dt); /* balance tree to avoid deep recursion */
443 l = r = &link; /* link._rght(_left) will be LEFT(RIGHT) tree after splaying */
444 if((root = tree->root) && _DTOBJ(disc,root) != obj) /* splay-search for a matching object */
516 { has_root: /* reconstitute the tree */
519 tree->root = root;
548 else if(type&DT_REMOVE) /* remove a particular element in the tree */
554 tree->root = root;
588 else /* no matching object, tree has been split to LEFT&RIGHT subtrees */
592 tree->root = link._left; /* tree is RIGHT tree */
594 { while((t = l->_rght) ) /* maximize root of LEFT tree */
599 l->_rght = link._left; /* hook RIGHT tree to LEFT root */
600 tree->root = l; /* LEFT tree is now the entire tree */
641 Dttree_t *tree = (Dttree_t*)dt->data;
644 { if(tree) /* already initialized */
646 if(!(tree = (Dttree_t*)(*dt->memoryf)(dt, 0, sizeof(Dttree_t), dt->disc)) )
647 { DTERROR(dt, "Error in allocating a tree data structure");
650 memset(tree, 0, sizeof(Dttree_t));
651 dt->data = (Dtdata_t*)tree;
655 { if(!tree)
657 if(tree->root)
659 (void)(*dt->memoryf)(dt, (Void_t*)tree, 0, dt->disc);
663 else if(event == DT_OPTIMIZE) /* balance the search tree */