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
Answer and explanation
Concise answer
40, 20, 30
Why this is correct
The search starts at 40. Since 30 is smaller, it moves to 20. Since 30 is larger than 20, it then moves to 30.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
