The set T represents various traversals over binary tree. The set S represents…

2026

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

image.png

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

  1. A.

    I–L, II–M, III–N

  2. B.

    I–M, II–L, III–N

  3. C.

    I–N, II–M, III–L

  4. D.

    I–N, II–L, III–M

Attempted by 233 students.

Show answer & explanation

Correct answer: A

To solve this, we need to match the traversal names in set T with their visiting orders in set S.

1. Inorder Traversal (I)

In an Inorder traversal, we visit the left subtree first, then the current node, and finally the right subtree. This corresponds to order: left subtree, node, right subtree. This matches description L.

2. Preorder Traversal (II)

In a Preorder traversal, we visit the current node first, then the left subtree, and finally the right subtree. This corresponds to order: node, left subtree, right subtree. This matches description M.

3. Postorder Traversal (III)

In a Postorder traversal, we visit the left subtree first, then the right subtree, and finally the current node. This corresponds to order: left subtree, right subtree, node. This matches description N.

Conclusion

Based on the above analysis: - I matches with L - II matches with M - III matches with N Therefore, the correct match is I–L, II–M, III–N.

Explore the full course: Gate Guidance By Sanchit Sir