GateAI
Binary Search Trees

GATE CSE 2011 · Q29

MCQ2 marksEasy

Time

We are given a set of nn distinct elements and an unlabeled binary tree with nn nodes. In how many ways can we populate the tree with the given set so that it becomes a binary search tree?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: B) 1

Binary Search Trees

In a Binary Search Tree (BST), an in-order traversal of the tree visits the keys in strictly increasing sorted order.

  • Since all nn elements in the given set are distinct, there is exactly one sorted sequence of these elements.

  • For a given fixed binary tree structure with nn nodes, the in-order traversal visits the nodes in a uniquely determined order of nn positions.

  • To satisfy the binary search tree property, the kk-th smallest element must be placed at the kk-th node visited during the in-order traversal for each k∈{1,2,…,n}k \in \{1, 2, \dots, n\}.

Therefore, there is exactly 1 way to place the elements into the fixed binary tree structure such that it becomes a valid binary search tree.

Hence, the correct option is (B) [p1].

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Binary Search Trees previous year question is Q29 of the GATE CSE 2011 paper. Find more GATE CSE PYQs on Binary Search Trees in Programming and Data Structures, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Binary Search Trees PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Binary Search Trees in GATE CSE

Binary Search Trees has 21 GATE CSE PYQs across 17 papers from 2011 to 2026. 6 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2011.

How GATE tests Binary Search Trees

More from GATE CSE 2011

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2011 · Q29 · MCQ

We are given a set of n distinct elements and an unlabeled binary tree with n nodes. In how many ways can we populate the tree with the given set so that it becomes a binary search tree?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.