The postorder traversal of a binary tree is DEBFCA. Which of the following can…

2012

The postorder traversal of a binary tree is DEBFCA. Which of the following can be the preorder traversal?

Answer: C. ABDECFConceptIn a binary tree, preorder visits Root → Left → Right, while postorder visits Left → Right → Root. A postorder sequence fixes the root as its last…

  1. A.

    ABFCDE

  2. B.

    ADBFEC

  3. C.

    ABDECF

  4. D.

    None of the above

Attempted by 16 students.

Show answer & explanation

Correct answer: C

Concept

In a binary tree, preorder visits Root → Left → Right, while postorder visits Left → Right → Root. A postorder sequence fixes the root as its last node, but by itself it generally does not fix how the earlier nodes split into left and right subtrees.

Therefore, a unique preorder normally requires extra structural information, such as an inorder traversal or a fully specified tree.

Application

  1. For DEBFCA, A must be the root because it is the last postorder node.

  2. For ABDECF, the remaining nodes can split as DEB for the left subtree and FC for the right subtree. Taking B and C as those subtree roots produces preorder ABDECF and postorder DEBFCA.

  3. The other explicit sequences cannot be paired with DEBFCA under the same preorder/postorder subtree-partition rule. Thus ABDECF is the compatible explicit choice.

Cross-check and result

Postorder alone is not unique: a one-child chain A → C → F → B → E → D also has postorder DEBFCA but preorder ACFBED. This confirms why the stem must ask which offered sequence can be the preorder, rather than claim that the preorder is uniquely determined.

Under that offered-choice reading, the result is ABDECF.

Explore the full course: Coding For Placement

Loading lesson…