| | | | | |

Binary Tree Iterator Algorithms: Reverse

  • Inorder, Preorder, Postorder are bidirectional
  • Reverse direction implemented with rInitialize and Decrement
  • Inorder::Decrement is same algorithm as Inorder::Increment with handedness reversed
  • Preorder::Decrement is same algorithm as Postorder::Increment with handedness reversed
  • Postorder::Decrement is same algorithm as Preorder::Increment with handedness reversed
  • Levelorder is forward only - can't "back up" the control queue

| | Top of Page | 14. BST Iterators - 9 of 41