Exam-style question
Try this first
A binary tree contains these values: root 40, left child 20, right child 60, and the right child of 20 is 30. Which sequence of values is examined when searching for 30?.
- A.20, 30
- B.40, 60, 30
- C.40, 20, 30
- D.40, 20, 60, 30
Model answer
What a good answer should say
- C.
- 40, 20, 30
Explanation
Why this works
The search starts at 40. Since 30 is smaller, it moves to 20.
Since 30 is larger than 20, it then moves to 30.
Common mistake
No common mistake is linked to this question yet.
