arrow
arrow
arrow
The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19. Which one of the following is the postorder traversal of the tree?
Question



The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19. Which one of the following is the postorder traversal of the tree?

A.

20, 19, 18, 16, 15, 12, 11, 10

B.

11, 12, 10, 16, 19, 18, 20, 15

C.

19, 16, 18, 20, 11, 12, 10, 15

D.

More than one of the above

E.

None of the above

Correct option is B


To determine the postorder traversal, we must first construct the Binary Search Tree (BST) from the given preorder traversal and then perform postorder traversal.
Step 1: Constructing the BST from Preorder Traversal
Given Preorder: 15, 10, 12, 11, 20, 18, 16, 19
· First Element (Root): 15
· Elements smaller than 15 go to the left subtree: 10, 12, 11
· Elements greater than 15 go to the right subtree: 20, 18, 16, 19
The BST structure:
15
/ \
10 20
\ /
12 18
/ / \
11 16 19
Step 2: Postorder Traversal
Postorder traversal follows the Left → Right → Root order.
1. Left Subtree (10):
· Left child: None
· Right child (12):
· Left child (11) → Visit 11
· Root (12) → Visit 12
· Root (10) → Visit 10
2. Right Subtree (20):
· Left child (18):
· Left child (16) → Visit 16
· Right child (19) → Visit 19
· Root (18) → Visit 18
· Root (20) → Visit 20
3. Root Node (15)Visit 15
Final Postorder Sequence:
11, 12, 10, 16, 19, 18, 20, 15
Since this matches option (b), the correct answer is (b) 11, 12, 10, 16, 19, 18, 20, 15.
Important Key Points:
1. Preorder Traversal (Root → Left → Right) helps in constructing the BST.
2. Postorder Traversal (Left → Right → Root) visits the left subtree first, then the right subtree, and finally the root.
3. BST Construction Rules:
· Left child < Parent
· Right child > Parent
4. Understanding Postorder Traversal Output:
· First, visit all left subtree nodes.
· Then, visit all right subtree nodes.
· Finally, visit the root node.
5. Application of Postorder Traversal:
· Used in deleting nodes from a tree.
· Used in expression tree evaluations (postfix notation).

Free Tests

Free
Must Attempt

DSSSB PRT Full Mock - 01

languageIcon English
  • pdpQsnIcon200 Questions
  • pdpsheetsIcon200 Marks
  • timerIcon120 Mins
languageIcon English
Free
Must Attempt

Educational Psychology & Pedagogy - 01

languageIcon English
  • pdpQsnIcon20 Questions
  • pdpsheetsIcon20 Marks
  • timerIcon15 Mins
languageIcon English
Free
Must Attempt

DSSSB PRT PYP Held on 7th March 2022 Shift 1

languageIcon English
  • pdpQsnIcon200 Questions
  • pdpsheetsIcon200 Marks
  • timerIcon120 Mins
languageIcon English
test-prime-package

Access ‘BPSC TRE (11-12)’ 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