Lines Matching refs:tree
2 static const char rcsid[] = "$Id: tree.c,v 1.4 2005/04/27 04:56:39 sra Exp $";
6 * tree - balanced binary tree library
13 * vix 02feb86 [added tree balancing from wirth "a+ds=p" p. 220-221]
41 /*#define DEBUG "tree"*/
51 #include <isc/tree.h>
90 static tree * sprout(tree **, tree_t, int *, int (*)(), void (*)());
91 static int delete(tree **, int (*)(), tree_t, void (*)(), int *, int *);
92 static void del(tree **, int *, tree **, void (*)(), int *);
93 static void bal_L(tree **, int *);
94 static void bal_R(tree **, int *);
97 tree_init(tree **ppr_tree) {
104 tree_srch(tree **ppr_tree, int (*pfi_compare)(tree_t, tree_t), tree_t p_user) {
131 tree_add(tree **ppr_tree, int (*pfi_compare)(tree_t, tree_t),
143 tree_delete(tree **ppr_p, int (*pfi_compare)(tree_t, tree_t),
154 tree_trav(tree **ppr_tree, int (*pfi_uar)(tree_t)) {
170 tree_mung(tree **ppr_tree, void (*pfv_uar)(tree_t)) {
177 memput(*ppr_tree, sizeof(tree));
183 static tree *
184 sprout(tree **ppr, tree_t p_data, int *pi_balance,
187 tree *p1, *p2, *sub;
197 *ppr = (tree *) memget(sizeof(tree));
338 delete(tree **ppr_p, int (*pfi_compare)(tree_t, tree_t), tree_t p_user,
341 tree *pr_q;
347 MSG("key not in tree")
385 memput(pr_q, sizeof(tree));
392 del(tree **ppr_r, int *pi_balance, tree **ppr_q,
416 bal_L(tree **ppr_p, int *pi_balance) {
417 tree *p1, *p2;
476 bal_R(tree **ppr_p, int *pi_balance) {
477 tree *p1, *p2;