Level-order Traversal
- Explain and trace level-order traversal.
In level-order traversal, nodes are visited level by level from left to right, starting from the root.
Following the level-order traversal will generate this sequence:
$$ 9, 5, 17, 2, 7, 12, 21, 4, 8, 14, 20, 25 $$
Exercise Carry out the level-order traversal for the following BST.
Solution
$$ 7, 2, 13, 4, 10, 15, 5, 8, 11, 14, 17 $$