arrow
arrow
arrow
Consider the following postorder traversal of a Binary Search Tree (BST): Postorder: 3, 5, 4, 8, 10, 9, 7 Which of the following is the correct pr
Question



Consider the following postorder traversal of a Binary Search Tree (BST): Postorder: 3, 5, 4, 8, 10, 9, 7
Which of the following is the correct preorder traversal of the BST?

A.

7, 9, 10, 8, 4, 5, 3

B.

7, 4, 5, 3, 9, 10, 8

C.

7, 4, 3, 5, 10, 9, 8

D.

7, 4, 3, 5, 9, 8, 10

E.

7, 9, 8, 10, 4, 5, 3

Correct option is D

To find the preorder traversal from the given postorder traversal of a Binary Search Tree (BST), we need to reconstruct the tree first.
Given Postorder Traversal: 3, 5, 4, 8, 10, 9, 7
Steps to Reconstruct the BST from Postorder:
1. Identify the Root: The last element in the postorder traversal is the root of the tree.
· Root = 7
2. Divide Elements into Subtrees: Elements before the root are divided into the left and right subtrees.
· Left Subtree: Elements smaller than the root (7): 3, 5, 4
· Right Subtree: Elements greater than the root (7): 8, 10, 9
Construct Left Subtree (Postorder: 3, 5, 4):
· Root of left subtree = 4
· Remaining elements: 3, 5
· Left Subtree: Elements smaller than 4: 3
· Right Subtree: Elements greater than 4: 5
Construct Right Subtree (Postorder: 8, 10, 9):
· Root of right subtree = 9
· Remaining elements: 8, 10
· Left Subtree: Elements smaller than 9: 8
· Right Subtree: Elements greater than 9: 10
Preorder Traversal:
1. Visit Root first: 7
2. Visit Left Subtree: 4, 3, 5
3. Visit Right Subtree: 9, 8, 10
Putting it all together, the Preorder traversal is: 7, 4, 3, 5, 9, 8, 10

Free Tests

Free
Must Attempt
Video Solutions

RBI Assistant Pre 2026 Full Mock Test -01

languageIcon English
  • pdpQsnIcon100 Questions
  • pdpsheetsIcon100 Marks
  • timerIcon60 Mins
languageIcon English
Free
Must Attempt
Video Solutions

RBI Asst Prelims 2026 : Reasoning Section Test 01

languageIcon English
  • pdpQsnIcon35 Questions
  • pdpsheetsIcon35 Marks
  • timerIcon20 Mins
languageIcon English
Free
Must Attempt
Video Solutions

RBI Asst Prelims 2026 : Quant Section Test 01

languageIcon English
  • pdpQsnIcon35 Questions
  • pdpsheetsIcon35 Marks
  • timerIcon20 Mins
languageIcon English
test-prime-package

Access ‘IBPS SO IT Officer’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
368k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow