Next: , Previous: Binary tree statistics, Up: Binary trees


14.4 Selecting nodes in a binary tree

— Function: Bstnode * bst_smallest (const Bstree *bst)

Finds the node in bst whose data is less than that of any other node. Note that this selection is performed without comparing nodes. Returns a null pointer if bst is empty.

— Function: Bstnode * bst_largest (const Bstree *bst)

Finds the node in bst whose data is greater than that of any other node. Note that this selection is performed without comparing nodes. Returns a null pointer if bst is empty.

— Function: Bstnode * bst_lookup (const Bstree *bst, void *target, void *cmp_args)

Finds the node in bst whose data compares equal to target, or return a null pointer if no such node can be found. cmp_args is passed as the last argument to bst's comparison function.