Next: Successor, Previous: RightRotate, Up: Private Routines
Search a tree for a node with comparable data.
#include <rbtree/rbtree.h>static Node *Search( Tree *tree, Node *x, const void *data, int (*cmp)(const void *,const void *) );
Tree *tree
- the tree to search
Node *x
- the node at which to start
const void *data
- the data to search for
int (*cmp)(const void *,const void *)
- the address of a node comparison routine
This routine will search a tree for the node which has data comparable to that passed, using the passed comparison routine. The start node need not be the root of the tree, allowing for subtree searches.
It returns the node which matches, else NIL(tree)
.