Exams › GATE › Technical
The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is the postorder traversal sequence of the same tree?
- 10, 20, 15, 23, 25, 35, 42, 39, 30
- 15, 10, 25, 23, 20, 42, 35, 39, 30
- 15, 20, 10, 23, 25, 42, 35, 39, 30
- 15, 10, 23, 25, 20, 35, 42, 39, 30
Correct answer: 15, 10, 23, 25, 20, 35, 42, 39, 30
Solution
The postorder traversal visits the left subtree, then the right subtree, and finally the root node. In this case, the sequence correctly reflects that order, with the root (30) appearing last after all left and right children have been processed.
Related GATE Technical questions
⚔️ Practice GATE Technical free + battle 1v1 →