Next: , Previous: rbtree_count, Up: Public Routines


3.1.4 rbtree_delete

Delete a red-black binary tree

Synopsis

     #include <rbtree/rbtree.h>
     
     
     
void rbtree_delete( RBTree rbtree, void (*nfree)(void *), Visit visit, SiblingOrder sibling_order );

Parameters

RBTree rbtree
the handle of the rbtree to delete
void (*nfree)(void *)
a routine which deallocates node user memory, may be RBTREE_NULL_DELETE
Visit visit
the order of deletion, either IN_ORDER, or POST_ORDER, (PRE_ORDER is treated as POST_ORDER)
          
          
Possible values for a Visit are as follows: PRE_ORDER, IN_ORDER, POST_ORDER
SiblingOrder sibling_order
the direction that the tree is parsed
          
          
Possible values for a SiblingOrder are as follows: LEFT_TO_RIGHT, RIGHT_TO_LEFT

Description

This routine deletes a red-black binary tree, destroying all nodes in the specified order and direction. It optionally takes a user supplied function which, when passed a node's data pointer, deallocates user node data. It is strongly suggested that the deallocation function be specified.