Computer Sciences > GATE 2026 SET-1 > Binary Search Tree
The following sequence corresponds to the preorder traversal of a binary search tree T:
50, 25, 13, 10, 30, 60, 55, 70, 65, 80, 75, 90

The position of the element 60 in the postorder traversal of T is ______. (answer in integer)
Note: The position begins with 1.

Correct : 11

To find the position of the element 60 in the postorder traversal, we first need to reconstruct the Binary Search Tree (BST) using the given preorder sequence.
1. Understanding the Properties
- Preorder Traversal: Visits nodes in the order: Root, Left Subtree, Right Subtree.
- BST Property: All elements in the left subtree are strictly smaller than the root, and all elements in the right subtree are strictly greater than the root.
2. Reconstructing the Tree
Given Preorder: 50, 25, 13, 10, 30, 60, 55, 70, 65, 80, 75, 90
- The first element, 50, is the Root.
- Elements smaller than 50 form the left subtree: {25, 13, 10, 30}
- Elements greater than 50 form the right subtree: {60, 55, 70, 65, 80, 75, 90}
Building the Left Subtree (Root = 25):
Left of 25: {13, 10} → Root is 13, Left is 10.
Right of 25: {30}
Building the Right Subtree (Root = 60):
Left of 60: {55}
Right of 60: {70, 65, 80, 75, 90} → Root is 70. Left is 65. Right is {80, 75, 90} (Root 80, Left 75, Right 90).
3. Finding the Postorder Traversal
Postorder visits nodes in the order: Left Subtree, Right Subtree, Root.
- Left Subtree of 50: 10, 13, 30, 25
- Right Subtree of 50: 55, 65, 75, 90, 80, 70, 60
- Root: 50

Full Postorder Sequence: 10, 13, 30, 25, 55, 65, 75, 90, 80, 70, 60, 50
4. Determining the Position
Counting the elements starting from position 1:
1: 10, 2: 13, 3: 30, 4: 25, 5: 55, 6: 65, 7: 75, 8: 90, 9: 80, 10: 70, 11: 60
The element 60 is at the 11th position.
Correct Answer: 11

Similar Questions

While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the lowest level is
#34 MCQ
What are the worst-case complexities of insertion and deletion of a key in a binary search tree?
#69 MCQ
Let T be a binary search tree with 15 nodes. The minimum and maximum possible heights of T are: Note: The height of a tree with a single node is 0.
#211 MCQ

Related Topics

binary search tree traversal preorder to postorder BST tree reconstruction data structures GATE CS tree questions postorder element position binary tree algorithms GATE computer science data structures BST root left right algorithm analysis tree

Unique Visitor Count

Total Unique Visitors

Loading......