Question

Consider a binary search tree (BST) with nn leaf nodes (n>0n > 0). Given any node VV, the key present in the node is denoted as Val(V)Val(V). All the keys present in the given BST are distinct. The keys belong to the set of real numbers.

For a node VV, let Suc(V)Suc(V) denote the node that is its inorder successor. If a node VV does not have an inorder successor, then Suc(V)Suc(V) is NULLNULL. As there are no duplicates, if Suc(V)Suc(V) is not NULLNULL, then Val(V)<Val(Suc(V))Val(V) < Val(Suc(V)).

Corresponding to every leaf node LiL_i that has a non-NULL Suc(Li)Suc(L_i), a new key kik_i with the following property is to be inserted into the BST.

Val(Li)<ki<Val(Suc(Li))Val(L_i) < k_i < Val(Suc(L_i))

Let KK represent the list of all such new keys to be inserted into the BST. Which of the following statements is/are true?

Choose every correct option
Official answer and solution
Official answer
A and C
From
Official GATE 2026 answer key

Solution

Analyze the open intervals (Val(Li),Val(Suc(Li)))(Val(L_i), Val(Suc(L_i))) for distinct leaves LiL_i and determine where each new key kik_i gets attached in the BST.

Let us check each statement:

  • (A) is true: For any two distinct nodes uu and vv with Val(u)<Val(v)Val(u) < Val(v), since Suc(u)Suc(u) is the smallest key in the BST strictly greater than Val(u)Val(u), we have Val(u)<Val(Suc(u))≤Val(v)<Val(Suc(v))Val(u) < Val(Suc(u)) \le Val(v) < Val(Suc(v)). Hence the open intervals (Val(Li),Val(Suc(Li)))(Val(L_i), Val(Suc(L_i))) are pairwise disjoint, so no two kik_i can be equal.
  • (B) is false: If the BST has only 1 node (or is a left-skewed chain where the single leaf is the maximum element in the tree), that leaf has Suc(L1)=NULLSuc(L_1) = NULL, so KK is empty.
  • (C) is true: Because LiL_i is a leaf and Val(Li)<ki<Val(Suc(Li))Val(L_i) < k_i < Val(Suc(L_i)), no existing key in the BST lies between Val(Li)Val(L_i) and kik_i, and LiL_i has no children. When kik_i is inserted into the BST, the search path must reach LiL_i and attach kik_i as the right child of LiL_i. Since at most one key kik_i is generated per leaf LiL_i, each existing leaf receives at most one right child, so the height of the BST increases by at most 11.
  • (D) is false: At most nn keys are inserted (where nn is the number of leaves), which is strictly less than the total number of nodes in any BST with ≥1\ge 1 node.
Final answer

Options (A), (C)

Common trap

Assuming KK must be non-empty without testing a 1-node BST or a right-skewed/left-skewed chain whose single leaf is the maximum element.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2026 Computer Science and Information Technology - Session 2 (CS2)
Question
49 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.