BST(3X)

NAME
bst_create, bst_destroy, bst_insert, bst_insert_uniq, bst_delete, bst_search, bst_minimum, bst_maximum, bst_successor, bst_predecessor, bst_iterate, bst_nextobj - binary search tree management functions

SYNOPSIS

#include "bst.h"

dict_h bst_create( oo_compare, ko_compare, flags, errnop )
int (*oo_compare)( dict_obj, dict_obj ) ;
int (*ko_compare)( dict_key, dict_obj ) ;
int flags ;
int *errnop ;

void bst_destroy( handle )
dict_h handle ;

int bst_insert( handle, object )
dict_h handle ;
dict_obj object ;

int bst_insert_uniq( handle, object, objectp )
dict_h handle ;
dict_obj object ;
dict_obj *objectp ;

int bst_delete( handle, object )
dict_h handle ;
dict_obj object ;

dict_obj bst_search( handle, key )
dict_h handle ;
dict_key key ;

dict_obj bst_minimum( handle )
dict_h handle ;

dict_obj bst_maximum( handle )
dict_h handle ;

dict_obj bst_successor( handle, object )
dict_h handle ;
dict_obj object ;

dict_obj bst_predecessor( handle, object )
dict_h handle ;
dict_obj object ;

void bst_iterate( handle, direction )
dict_h handle ;
enum dict_direction direction ;

dict_obj bst_nextobj( handle )
dict_h handle ;

DESCRIPTION

This library supports dictionary functions using binary search trees. It follows the standard library interface which is described in dict(3). The flags supported by bst_create() include:

    DICT_RETURN_ERROR

    DICT_UNIQUE_KEYS

    DICT_ORDERED

    DICT_BALANCED_TREE
        the tree will be kept balanced (the implementation uses red-black trees to enforce this property).

SEE ALSO
dict(3)

RETURN VALUES
Check dict(3) for function return values and error codes.