Computer Sciences > GATE 2026 SET-2 > Data Structures
The set T represents various traversals over binary tree. The set S represents the order of visiting nodes during a traversal.

Which one of the following is the correct match from T to S?
A
I-L, II-M, III-N
B
I-M, II-L, III-N
C
I-N, II-M, III-L
D
I-L, II-N, III-M

Correct : a

To find the correct match, we need to recall the standard definitions of the three primary depth-first binary tree traversals: Inorder, Preorder, and Postorder.

I: Inorder Traversal (Matches L)
In an inorder traversal, the algorithm recursively visits the left subtree, then processes the root node, and finally recursively visits the right subtree. Therefore, I correctly matches L (left subtree, node, right subtree).

II: Preorder Traversal (Matches M)
In a preorder traversal, the algorithm processes the root node first, before moving on to recursively visit the left subtree, and finally the right subtree. Therefore, II correctly matches M (node, left subtree, right subtree).

III: Postorder Traversal (Matches N)
In a postorder traversal, the algorithm recursively visits the left subtree, then recursively visits the right subtree, and processes the root node at the very end. Therefore, III correctly matches N (left subtree, right subtree, node).

Correct Match: I-L, II-M, III-N βœ“

Similar Questions

Which one of the following sequences when stored in an array at locations A[1],...,A[10] forms a max-heap?
#950 MCQ
Let SLLdel be a function that deletes a node in a singly-linked list given a pointer to the node and a pointer to the head of the list. Similarly, let DLLdel be...
#951 MCQ
An algorithm has to store several keys generated by an adversary in a hash table. The adversary is malicious who tries to maximize the number of collisions. Let...
#957 MCQ

Related Topics

binary tree traversals inorder preorder postorder tree traversal order data structures GATE questions left node right subtree match traversals GATE CS computer science tree algorithms depth first search tree tree node visiting sequence

Unique Visitor Count

Total Unique Visitors

Loading......