The GATE Grind

GATE 2026 CS (CS2) – Question 12

Programming and Data Structures · Trees and Binary Search Trees · 1 mark · Multiple choice

The set $T$ represents various traversals over a binary tree. The set $S$ represents the order of visiting nodes during a traversal.

$I$: Inorder
$II$: Preorder
$III$: Postorder

$L$: left subtree, node, right subtree
$M$: node, left subtree, right subtree
$N$: left subtree, right subtree, node

Which one of the following is the correct match from $T$ to $S$?

  1. I-L, II-M, III-N
  2. I-M, II-L, III-N
  3. I-N, II-M, III-L
  4. I-L, II-N, III-M

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (A) I-L, II-M, III-N

Explanation

Inorder traversal visits left subtree, then node, then right subtree, so $I \to L$. Preorder visits node first, then left subtree, then right subtree, so $II \to M$. Postorder visits left subtree, then right subtree, then node, so $III \to N$. Therefore, option (A) is correct.