Q48.Marks: +2.0UGC NET Paper 2: Computer Science 2nd January 2026 Shift 1
The inorder and preorder traversal of binary tree are d, b, e, a, f, c, g and a, b, d, e, c, f, g respectively. The postorder traversal of the binary tree is
1.d, e, b, f, g, c, a✓ Correct
2.e, d, b, g, f, c, a
3.e, d, b, f, g, c, a
4.d, e, f, g, b, c, a
Solution
The correct answer is d, e, b, f, g, c, a.
Key Points
The inorder traversal of a binary tree involves visiting the nodes in the order: Left Subtree → Root → Right Subtree.
The preorder traversal involves visiting the nodes in the order: Root → Left Subtree → Right Subtree.
The postorder traversal involves visiting the nodes in the order: Left Subtree → Right Subtree → Root.
Given the inorder and preorder traversals, the corresponding postorder traversal is determined by reconstructing the tree.
Using the provided traversals:
Inorder: d, b, e, a, f, c, g
Preorder: a, b, d, e, c, f, g
The correct postorder traversal is: d, e, b, f, g, c, a.
Additional Information
Steps to Determine Postorder Traversal:
Identify the root from the preorder traversal (the first element).
Find the root's position in the inorder traversal to divide the tree into left and right subtrees.
Recursively apply the same logic to the left and right subtrees to derive their postorder traversals.
Combine the left subtree, right subtree, and root to get the final postorder traversal.
Applications of Tree Traversals:
Inorder Traversal: Used to retrieve data in sorted order for binary search trees.
Preorder Traversal: Used for creating a copy of the tree or expressing it in a prefix notation.
Postorder Traversal: Used for deleting the tree or expressing it in a postfix notation.
Important Points:
Tree traversals are fundamental in computer science and are used in various applications such as parsing expressions, file systems, and network routing algorithms.
Understanding the order of traversal is crucial for solving problems related to binary trees.