GATE CS 2026, set 2 · Question 49 · Programming and Data Structures · Multiple select (MSQ) · 2 marks · no negative marks
Consider a binary search tree (BST) with n leaf nodes (n > 0). Given any node V, the key present in the node is denoted as Val(V). All the keys present in the given BST are distinct. The keys belong to the set of real numbers.
For a node V, let Suc(V) denote the node that is its inorder successor. If a node V does not have an inorder successor, then Suc(V) is NULL. As there are no duplicates, if Suc(V) is not NULL, then Val(V) < Val(Suc(V)).
Corresponding to every leaf node Lᵢ that has a non-NULL Suc(Lᵢ), a new key kᵢ with the following property is to be inserted into the BST.
Val(Lᵢ) < kᵢ < Val(Suc(Lᵢ))
Let K represent the list of all such new keys to be inserted into the BST.
Which of the following statements is/are true?
- (A) K cannot have any duplicates
- (B) K will have at least one element
- (C) After inserting all keys from K, the height of the BST can increase at most by one
- (D) Number of nodes in the BST will double after inserting all keys from K
Answer
Answer (A), (C)
Answer from the official GATE CS 2026 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes