Skip to content
Official PYQ · 1987

GATE CS 1987 Q2c — Trees

Explain with AI
State whether the following statements are TRUE or FALSE:

It is possible to construct a binary tree uniquely whose pre-order and post-order traversals are given?
View worked solution

Answer: 0

The statement is FALSE (represented as 0).

To uniquely construct a binary tree, we need either:

  • Pre-order and In-order traversals, or
  • Post-order and In-order traversals.

Pre-order and Post-order traversals are not sufficient to uniquely reconstruct a general binary tree because we cannot unambiguously determine whether a single child of a node is a left child or a right child.

Counterexample:

Consider a binary tree with two nodes, AA and BB. Let:

  • Pre-order=A,B\text{Pre-order} = A, B
  • Post-order=B,A\text{Post-order} = B, A

There are two distinct binary trees that yield these same traversals:

  1. AA is the root, and BB is its left child.
  2. AA is the root, and BB is its right child.

Since we cannot uniquely distinguish between these two structures, the statement is false.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Trees questions