Lines Matching refs:tree
48 * AVL tree implementation uses 3 pointers. The following chart gives the
51 * Operation Link List AVL tree
74 * 1. Create the list/tree with: avl_create()
89 * 2d. Remove individual nodes from the list/tree with avl_remove().
97 * 4. Use avl_destroy() to destroy the AVL tree itself.
105 * Type used for the root of the AVL tree.
110 * The data nodes in the AVL tree must have a field of this type.
115 * An opaque type used to locate a position in the tree where a node
143 * Initialize an AVL tree. Arguments are:
145 * tree - the tree to be initialized
151 extern void avl_create(avl_tree_t *tree,
156 * Find a node with a matching value in the tree. Returns the matching node
163 extern void *avl_find(avl_tree_t *tree, const void *node, avl_index_t *where);
166 * Insert a node into the tree.
171 extern void avl_insert(avl_tree_t *tree, void *node, avl_index_t where);
174 * Insert "new_data" in "tree" in the given "direction" either after
181 * here - existing node in "tree"
184 extern void avl_insert_here(avl_tree_t *tree, void *new_data, void *here,
189 * Return the first or last valued node in the tree. Will return NULL
190 * if the tree is empty.
193 extern void *avl_first(avl_tree_t *tree);
194 extern void *avl_last(avl_tree_t *tree);
198 * Return the next or previous valued node in the tree.
204 #define AVL_NEXT(tree, node) avl_walk(tree, node, AVL_AFTER)
205 #define AVL_PREV(tree, node) avl_walk(tree, node, AVL_BEFORE)
218 * avl_tree_t *tree;
224 * node = avl_find(tree, &look_for_value, &where);
226 * less = AVL_PREV(tree, node);
228 * less = avl_nearest(tree, where, AVL_BEFORE);
230 extern void *avl_nearest(avl_tree_t *tree, avl_index_t where, int direction);
234 * Add a single node to the tree.
235 * The node must not be in the tree, and it must not
236 * compare equal to any other node already in the tree.
240 extern void avl_add(avl_tree_t *tree, void *node);
244 * Remove a single node from the tree. The node must be in the tree.
248 extern void avl_remove(avl_tree_t *tree, void *node);
267 * Return the number of nodes in the tree
269 extern ulong_t avl_numnodes(avl_tree_t *tree);
272 * Return B_TRUE if there are zero nodes in the tree, B_FALSE otherwise.
274 extern boolean_t avl_is_empty(avl_tree_t *tree);
277 * Used to destroy any remaining nodes in a tree. The cookie argument should
279 * removed from the tree and may be free()'d. Returns NULL when the tree is
288 * avl_tree_t *tree;
293 * while ((node = avl_destroy_nodes(tree, &cookie)) != NULL)
295 * avl_destroy(tree);
297 extern void *avl_destroy_nodes(avl_tree_t *tree, void **cookie);
301 * Final destroy of an AVL tree. Arguments are:
303 * tree - the empty tree to destroy
305 extern void avl_destroy(avl_tree_t *tree);