Question:

The set T represents various traversals over binary tree. The set S represents the
order of visiting nodes during a traversal.
T
S
I: Inorder
L: left subtree, node, right subtree
II: Preorder
M: node, left subtree, right subtree
III: Postorder N: left subtree, right subtree, node
Which one of the following is the correct match from T to S ?

Show Hint

Remember: Inorder = Left-Node-Right, Preorder = Node-Left-Right, Postorder = Left-Right-Node.
Updated On: Jul 7, 2026
  • I - L, II - M, III - N
  • I - M, II - L, III - N
  • I - N, II - M, III - L
  • I - L, II - N, III - M
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

Step 1: Recall the standard definitions of the three basic binary tree traversals. Inorder traversal visits nodes in the order: left subtree, then the node, then right subtree. Preorder traversal visits nodes in the order: node, then left subtree, then right subtree. Postorder traversal visits nodes in the order: left subtree, then right subtree, then the node.
Step 2: Now compare these with the descriptions given in set S. Description L says 'left subtree, node, right subtree', which is exactly the Inorder pattern. Description M says 'node, left subtree, right subtree', which is exactly the Preorder pattern. Description N says 'left subtree, right subtree, node', which is exactly the Postorder pattern.
Step 3: So the correct correspondence is: I (Inorder) matches L, II (Preorder) matches M, and III (Postorder) matches N.
Final Answer: Option (A): I - L, II - M, III - N
Was this answer helpful?
0
0

Top GATE CS Computer Science and IT Engineering Questions

View More Questions

Top GATE CS Trees Questions