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?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2013 · Q43
Time
Select one answerSingle correct
Solution
Official answer: D) 15, 10, 23, 25, 20, 35, 42, 39, 30
Binary Search TreesGiven the preorder traversal: .
In a Binary Search Tree (BST), the root is the first element in preorder, and elements smaller than the root form the left subtree while elements greater form the right subtree.
Root:
Left Subtree (elements ): Preorder is
Right Subtree (elements ): Preorder is
Construct Left Subtree:
Root is .
Left of (): Root , right child .
Right of (): Root , left child .
Postorder of left subtree (Left Right Root):
Left of :
Right of :
Combining with root :
Construct Right Subtree:
Root is .
Left child (): .
Right child (): .
Postorder of right subtree:
Overall Postorder Traversal:
This matches option (D).
Try the question first, then check your work.
Examiner trap
In a BST, the inorder traversal is always sorted in ascending order. You can use the given preorder and sorted inorder to construct the unique binary tree and find its postorder traversal.
This Binary Search Trees previous year question is Q43 of the GATE CSE 2013 paper. Find more GATE CSE PYQs on Binary Search Trees in Programming and Data Structures, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Binary Search Trees PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Binary Search Trees has 21 GATE CSE PYQs across 17 papers from 2011 to 2026. 6 of them are 2-mark MCQs like this one, and GATE CSE 2013 has 2.
How GATE tests Binary Search TreesIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.