Next: uTraverse, Previous: Successor, Up: Private Routines
Walk a tree, processing each node.
#include <rbtree/rbtree.h>static int Traverse( Tree *tree, Node *node, int (*action)(void *), SiblingOrder sibling_order );
Tree *tree
- the tree to walk
Node *node
- the node to start at, must be
ROOT(tree)
int (*action)(void *)
- the action to perform at each node
SiblingOrder sibling_order
- the order in which to traverse the tree
Possible values for aSiblingOrder
are as follows:LEFT_TO_RIGHT
,RIGHT_TO_LEFT
Traverse
quickly walks a tree in a prescribed order, performing a
user supplied action on each node, in-order. If the action function
returns non-zero, the walk is aborted.
If the action routines all return ‘0’, it returns ‘0’, else it returns the value returned by the last action routine called.