AVL_ADD(3AVL) AVL Tree Library Functions AVL_ADD(3AVL)
avl_add, avl_remove - add and remove nodes from an AVL tree
AVL Tree Library (libavl, -lavl)
#include <sys/avl.h>
void
avl_add(avl_tree_t *tree, void *node);
void
avl_remove(avl_tree_t *tree, void *node);
The avl_add() and avl_remove() functions add and remove objects from
the AVL tree rooted at tree.
The avl_add() function inserts node into the tree. node must not
already be in the tree, thus implying it must not compare equal to any
other node in the tree. Adding node to tree will take O(log(n)) time,
as it implicitly determines where to place it in the tree. If node's
location has already been determined by avl_find(3AVL), then instead
use avl_insert(3AVL).
The avl_remove() function removes node from the tree rooted at tree.
node must be present in the tree, otherwise, the behavior is undefined.
Deleting node from tree occurs in O(log(n)) time.
See the EXAMPLES section in libavl(3LIB).
Committed
MT-Level
See Locking in libavl(3LIB).
avl_create(3AVL), avl_destroy(3AVL), avl_insert(3AVL),
avl_insert_here(3AVL), libavl(3LIB)
illumos April 13, 2015 illumos
NAME
avl_add, avl_remove - add and remove nodes from an AVL tree
SYNOPSIS
AVL Tree Library (libavl, -lavl)
#include <sys/avl.h>
void
avl_add(avl_tree_t *tree, void *node);
void
avl_remove(avl_tree_t *tree, void *node);
DESCRIPTION
The avl_add() and avl_remove() functions add and remove objects from
the AVL tree rooted at tree.
The avl_add() function inserts node into the tree. node must not
already be in the tree, thus implying it must not compare equal to any
other node in the tree. Adding node to tree will take O(log(n)) time,
as it implicitly determines where to place it in the tree. If node's
location has already been determined by avl_find(3AVL), then instead
use avl_insert(3AVL).
The avl_remove() function removes node from the tree rooted at tree.
node must be present in the tree, otherwise, the behavior is undefined.
Deleting node from tree occurs in O(log(n)) time.
EXAMPLES
See the EXAMPLES section in libavl(3LIB).
INTERFACE STABILITY
Committed
MT-Level
See Locking in libavl(3LIB).
SEE ALSO
avl_create(3AVL), avl_destroy(3AVL), avl_insert(3AVL),
avl_insert_here(3AVL), libavl(3LIB)
illumos April 13, 2015 illumos