AVL_FIND(3AVL) AVL Tree Library Functions AVL_FIND(3AVL)

## NAME

**avl_find **- find a node in an AVL tree

## SYNOPSIS

AVL Tree Library (libavl, -lavl)

**#include <sys/avl.h>**

__void__ __*__

**avl_find**(__avl_tree_t__ __*tree__, __const__ __void__ __*node__, __avl_index_t__ __*where__);

## DESCRIPTION

The**avl_find**() function is used to look up a node in the tree rooted at

__tree__.

To perform a lookup, a caller should construct an instance of the data

structure, the argument__node__. **avl_find**() searches through the tree for a

node which compares equal to the passed in__node__ using the comparison

function specified when the tree was created with avl_create(3AVL). The

only fields of__node__ that need to be initialized are those that the

comparison function will use, the others may remain uninitialized.

If a match exists in the tree, then that entry will be returned.

Otherwise,**NULL **is returned.

If__node__ does not match anything in the tree and the value of __where__ is a

non-**NULL **pointer, then __where__ will be updated to a value that can be used

with both avl_insert(3AVL) and avl_nearest(3AVL). This value is only valid

as long as the tree is not modified. If anything is added or removed from

the tree, then the value of__where__ is no longer valid. This is commonly

used as part of a pattern to see if something that should be added to the

tree already exists, and if not, insert it. For more information, see the

examples in libavl(3LIB).

If the lookup is successful, then the contents of__where__ are undefined.

## RETURN VALUES

If__node__ matches an entry in the tree, the matching entry is returned.

Otherwise,**NULL **is returned and if __where__ is non-**NULL**, it is updated to

point to a location in the tree.

## EXAMPLES

See the**EXAMPLES **section in libavl(3LIB).

## INTERFACE STABILITY

**Committed**

**MT-Level**

See__Locking__ in libavl(3LIB).

## SEE ALSO

avl_create(3AVL), avl_insert(3AVL), avl_nearest(3AVL), libavl(3LIB)

illumos May 7, 2015 illumos

AVL Tree Library (libavl, -lavl)

The

To perform a lookup, a caller should construct an instance of the data

structure, the argument

node which compares equal to the passed in

function specified when the tree was created with avl_create(3AVL). The

only fields of

comparison function will use, the others may remain uninitialized.

If a match exists in the tree, then that entry will be returned.

Otherwise,

If

non-

with both avl_insert(3AVL) and avl_nearest(3AVL). This value is only valid

as long as the tree is not modified. If anything is added or removed from

the tree, then the value of

used as part of a pattern to see if something that should be added to the

tree already exists, and if not, insert it. For more information, see the

examples in libavl(3LIB).

If the lookup is successful, then the contents of

If

Otherwise,

point to a location in the tree.

See the

See

avl_create(3AVL), avl_insert(3AVL), avl_nearest(3AVL), libavl(3LIB)

illumos May 7, 2015 illumos