The numbers 70, 50, 10, 80, 30, 60, 100, 90, 40, 20 are inserted in the given…
2021
The numbers 70, 50, 10, 80, 30, 60, 100, 90, 40, 20 are inserted in the given order into a binary search tree. What is the in-order traversal sequence of the resultant binary search tree?
- A.
70, 50, 10, 80, 30, 60, 100, 90, 40, 20
- B.
100, 90, 80, 70, 60, 50, 40, 30, 20, 10
- C.
10, 30, 50, 70, 90, 20, 40, 60, 80, 100
- D.
10, 20, 30, 40, 50, 60, 70, 80, 90, 100
Attempted by 357 students.
Show answer & explanation
Correct answer: D
Correct answer: 10, 20, 30, 40, 50, 60, 70, 80, 90, 100
In a Binary Search Tree, an inorder traversal always follows Left → Root → Right. This visits the keys in ascending order.
The inserted values are: 70, 50, 10, 80, 30, 60, 100, 90, 40, 20.
After insertion, the inorder traversal is simply the sorted order of these values:
10, 20, 30, 40, 50, 60, 70, 80, 90, 100.