AVL_FIRST(3AVL) AVL Tree Library Functions AVL_FIRST(3AVL)

## NAME

**avl_first**, **AVL_NEXT**, **AVL_PREV**, **avl_last **- get the first, next, previous,

and last entries from an AVL tree

## SYNOPSIS

AVL Tree Library (libavl, -lavl)

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

__void__ __*__

**avl_first**(__avl_tree_t__ __*tree__);

__void__ __*__

**avl_last**(__avl_tree_t__ __*tree__);

__void__ __*__

**AVL_NEXT**(__avl_tree_t__ __*tree__, __void__ __*node__);

__void__ __*__

**AVL_PREV**(__avl_tree_t__ __*tree__, __void__ __*node__);

## DESCRIPTION

The**avl_first**() and **avl_last**() respectively return the first and last entry

in the tree specified by__tree__. Order in the tree is determined by the

comparison function that was specified at the time the tree was created

with avl_create(3AVL). If__tree__ is empty, then **avl_first**() and **avl_last**()

return**NULL**.

The**AVL_NEXT**() and **AVL_PREV**() functions are macros that may be used to

obtain the next and previous entry following__node__ in the AVL tree __tree__. If

there is no next or previous node, for example, if one was at the beginning

or end of the tree, then**NULL **is returned.

These constructs are generally used as part of loops to iterate the tree.

See the examples section in libavl(3LIB) for more information on using this

interface.

## RETURN VALUES

The**avl_first**() function returns a pointer to the first entry in the AVL

tree__tree__ or **NULL **if the AVL tree is empty.

The**avl_last**() function returns a pointer to the last entry in the AVL tree

__tree__ or **NULL **if the AVL tree is empty.

The**AVL_NEXT**() macro returns a pointer to the object in the tree that

follows__node__. If __node__ is the last entry in the tree, **NULL **is returned

instead.

The**AVL_PREV**() macro returns a pointer to the object in the tree that

precedes__node__. If __node__ is the first entry in the tree, **NULL **is returned

instead.

## EXAMPLES

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

## INTERFACE STABILITY

**Committed**

**MT-Level**

See__Locking__ in libavl(3LIB).

## SEE ALSO

avl_create(3AVL), libavl(3LIB)

illumos May 7, 2015 illumos

and last entries from an AVL tree

AVL Tree Library (libavl, -lavl)

The

in the tree specified by

comparison function that was specified at the time the tree was created

with avl_create(3AVL). If

return

The

obtain the next and previous entry following

there is no next or previous node, for example, if one was at the beginning

or end of the tree, then

These constructs are generally used as part of loops to iterate the tree.

See the examples section in libavl(3LIB) for more information on using this

interface.

The

tree

The

The

follows

instead.

The

precedes

instead.

See the

See

avl_create(3AVL), libavl(3LIB)

illumos May 7, 2015 illumos