13.5.1 Starting at the First Node |
Finding the smallest node in the tree is just a matter of starting from the root and descending as far to the left as we can.
505. <PBST traverser first initializer 505> = void *
pbst_t_first (struct pbst_traverser *trav, struct pbst_table *tree)
{ assert (tree != NULL && trav != NULL); trav->pbst_table = tree; trav->pbst_node = tree->pbst_root; if (trav->pbst_node != NULL)
{ while (trav->pbst_node->pbst_link[0] != NULL) trav->pbst_node = trav->pbst_node->pbst_link[0]; return trav->pbst_node->pbst_data; } else
return NULL; }