Next: , Previous: BndSearch, Up: Private Routines


3.2.2 Delete

Remove a node from a tree.

Synopsis

     #include <rbtree/rbtree.h>
     
     
     
static Node *Delete( Tree *tree, Node *z );

Parameters

Tree *tree
the tree from which to delete the node
Node *z
the node to delete

Description

Delete removes a node from a tree. The node removed may not be that requested to be removed, for algorithmic efficiency's sake. in this case, the data is swapped with the node that is removed, so everything works as expected. It does not deallocate the memory associated with the node.

Returns

It returns a pointer to the node that was actually removed.