Binary search tree: traverse: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 2: | Line 2: | ||
== Genaral Information == | == Genaral Information == | ||
'''Algorithmic problem:''' [[Sorted sequence|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>\{0,1,2\}</math> and | |||
## a binary search tree node '''''node'''''. | |||
# Pointers '''''elem''''' and '''''elem'''''' to stack elements. | |||
== Abstract View == | == Abstract View == |
Revision as of 20:11, 25 September 2014
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