Question:easy

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

The Correct Option is A

Solution and Explanation

Step 1: Instead of memorizing definitions, verify by tracing a tiny example tree with root A, left child B, and right child C.
Step 2: Preorder visits node first: the sequence produced is A, B, C, which follows the pattern 'node, left, right' - this is description M.
Step 3: Inorder visits the left child before the node: the sequence produced is B, A, C, which follows the pattern 'left, node, right' - this is description L.
Step 4: Postorder visits the node last: the sequence produced is B, C, A, which follows the pattern 'left, right, node' - this is description N.
Step 5: This trace confirms I (Inorder) - L, II (Preorder) - M, III (Postorder) - N, without needing to recall the definitions from memory.
Final Answer: Option (A)
Was this answer helpful?
0

Top Questions on Trees


Questions Asked in GATE CS exam