Next: Free_in_order, Previous: BndSearch, Up: Private Routines
Remove a node from a tree.
#include <rbtree/rbtree.h>static Node *Delete( Tree *tree, Node *z );
Tree *tree
- the tree from which to delete the node
Node *z
- the node to delete
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.
It returns a pointer to the node that was actually removed.