Binary search tree: traverse
Genaral Information
Algorithmic problem: Sorted sequence: traverse
Type of algorithm: loop
Auxiliary data:
- A stack S whose elements are pairs consisting of
- a natural number seenChildren in the range [math]\displaystyle{ \{0,1,2\} }[/math] and
- a binary search tree node node.
- Pointers elem and elem' to stack elements.
Abstract View
Induction Basis
Induction Step
Complexity
Pseudocode
- INORDER-TREE-WALK(x)
- if x ≠ NULL
- INORDER-TREE-WALK(left[x])
- print key[x]
- INORDER-TREE-WALK(right[x])
- if x ≠ NULL