The preorder traversal of a Binary Search Tree (BST) is (10, 5, 1, 7, 40, 50).…

2023

The preorder traversal of a Binary Search Tree (BST) is (10, 5, 1, 7, 40, 50). What is its postorder traversal?

  1. A.

    (1, 5, 7, 10, 40, 50)

  2. B.

    (50, 40, 10, 7, 5, 1)

  3. C.

    (1, 7, 5, 10, 40, 50)

  4. D.

    None of these

Attempted by 292 students.

Show answer & explanation

Correct answer: D

Correct answer: None of these

Preorder traversal follows Root → Left → Right. So the first value, 10, is the root.

  1. Values smaller than 10 form the left subtree: 5, 1, 7. This subtree has root 5, with 1 on the left and 7 on the right. Its postorder is 1, 7, 5.

  2. Values greater than 10 form the right subtree: 40, 50. This subtree has root 40, with 50 on the right. Its postorder is 50, 40.

  3. Combine left postorder, right postorder, and root: 1, 7, 5, 50, 40, 10.

The obtained sequence is not present in the listed numerical options, so None of these is correct.

Explore the full course: Isro