10.6 Traversal [ToC] [Index]     [Skip Back] [Skip Fwd]     [Prev] [Up] [Next]

Traversal in an RTBST is unusual due to its asymmetry. Moving from smaller nodes to larger nodes is easy: we do it with the same algorithm used in a TBST. Moving the other way is more difficult and inefficient besides: we have neither a stack of parent nodes to fall back on nor left threads to short-circuit.

RTBSTs use the same traversal structure as TBSTs, so we can reuse some of the functions from TBST traversers. We also get a few directly from the implementations for BSTs. Other than that, everything has to be written anew here:

395. <RTBST traversal functions 395> =
<TBST traverser null initializer; tbst => rtbst 269>
<RTBST traverser first initializer 396>
<RTBST traverser last initializer 397>
<RTBST traverser search initializer 398>
<TBST traverser insertion initializer; tbst => rtbst 273>
<TBST traverser copy initializer; tbst => rtbst 274>
<RTBST traverser advance function 399>
<RTBST traverser back up function 400>
<BST traverser current item function; bst => rtbst 74>
<BST traverser replacement function; bst => rtbst 75>

This code is included in 375, 418, and 455.