GATE CS 2026 · Set-2 · Arrays & Matrix Representation

MSQ · 2 marks · Problem PROG-DSTR-0078

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 \(\operatorname{Suc}(V)\) is \(N U L L\). As there are no duplicates, if \({Suc}(V)\) is not \(N U L L\), then \({Val}(V) < {Val}({Suc}(V))\). Corresponding to every leaf node \(L_{i}\) that has a non-NULL \(\operatorname{Suc}\left(L_{i}\right)\), a new key \(k_{i}\) with the following property is to be inserted into the BST.\({Val}\left(L_{i}\right) < k_{i} < Val ({Suc}(L_{i}))\) Let \(K\) represent the list of all such new keys to be inserted into the BST. Which of the following statements is/are true?
  1. A
    \(K\) cannot have any duplicates
  2. B
    \(K\) will have at least one element
  3. C
    After inserting all keys from \(K\), the height of the BST can increase at most by one
  4. D
    Number of nodes in the BST will double after inserting all keys from \(K\)

Solve it on GATE DA practice →More Basic Data Structures problems

Show the worked solutionOfficial GATE Answer Key: A, C.See full step-by-step discussion on GateOverflow: https://gateoverflow.in/523107/gate-cse-2026-set-2-question-39

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com