Exam-style question
Try this first
Consider this tree: M is the root; M has left child F and right child T; F has left child C and right child H; T has left child R and right child W. What is the pre-order traversal?.
- A.M, F, C, H, T, R, W
- B.C, F, H, M, R, T, W
- C.C, H, F, R, W, T, M
- D.M, T, W, R, F, H, C
Model answer
What a good answer should say
- M, F, C, H, T, R, W
Explanation
Why this works
Pre-order visits the current node first, then the left subtree, and then the right subtree. Starting at M gives M, F, C, H, T, R, W.
Common mistake
No common mistake is linked to this question yet.
