Consider a binary search tree (BST) with 𝑛 leaf nodes (𝑛 > 0). Given any…

2026

Consider a binary search tree (BST) with 𝑛 leaf nodes (𝑛 > 0). Given any node 𝑉, the key present in the node is denoted as π‘‰π‘Žπ‘™(𝑉). All the keys present in the given BST are distinct. The keys belong to the set of real numbers. For a node 𝑉, let 𝑆𝑒𝑐(𝑉) denote the node that is its inorder successor. If a node 𝑉 does not have an inorder successor, then 𝑆𝑒𝑐(𝑉) is π‘π‘ˆπΏπΏ. As there are no duplicates, if 𝑆𝑒𝑐(𝑉) is not π‘π‘ˆπΏπΏ, then π‘‰π‘Žπ‘™(𝑉) < π‘‰π‘Žπ‘™(𝑆𝑒𝑐(𝑉)).

Corresponding to every leaf node 𝐿𝑖 that has a non-NULL 𝑆𝑒𝑐(𝐿𝑖), a new key π‘˜π‘– with the following property is to be inserted into the BST.
π‘‰π‘Žπ‘™(𝐿𝑖) < π‘˜π‘– < π‘‰π‘Žπ‘™(𝑆𝑒𝑐(𝐿𝑖))
Let 𝐾 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 𝐾, 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

Attempted by 19 students.

Show answer & explanation

Correct answer: A, C

Core Idea

For every leaf LiL_iLi​ with successor:

Val(Li)<ki<Val(Suc(Li))\text{Val}(L_i) < k_i < \text{Val}(Suc(L_i))Val(Li​)<ki​<Val(Suc(Li​))

So each new key lies strictly between two consecutive inorder elements

Option A: K cannot have duplicates

TRUE

  • Each kik_iki​ lies in a unique open interval between two consecutive keys

  • Intervals do not overlap
    So no two kik_iki​ can be equal

Option B: K will have at least one element

FALSE

  • If BST has only one node (also a leaf)

  • It has no successor
    No kik_iki​ generated

  • Option C: Height increases at most by one

TRUE

  • Each kik_iki​ is inserted between a leaf and its successor

  • So it becomes child of that leaf
    Only extends leaf depth by 1

Option D: Number of nodes doubles
FALSE

  • New keys = number of leaves with successor

  • In skewed tree β†’ only 1 such leaf
    Not doubling

Final Answer:

A and C

Explore the full course: Gate Guidance By Sanchit Sir