GATE CS 2026 Set 2 | Question 49
Programming & Data Structures › Trees · MSQ · 2 marks · Answer: A, C
- Question 49Programming & Data Structuresmsq2 marksConsider a binary search tree (BST) with leaf nodes (); all keys are distinct reals. For a node , is its inorder successor ( if none), and if then . For every leaf node with a non-NULL , a new key with is inserted into the BST. Let be the list of all such new keys. Which of the following statements is/are true?
- A.cannot have any duplicates✓
- B.will have at least one element
- C.After inserting all keys from , 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
Answer: A, C
Solution
Answer: (A), (C) - (A) Each lies in the disjoint open interval ; these intervals are pairwise disjoint, so all are distinct. True ✓ - (B) If the tree is a single node (a leaf with no successor), is empty. False ✗ - (C) Each is inserted just after an existing leaf/successor, adding at most one new level, so overall height grows by at most 1. True ✓ - (D) (total nodes), so the count does not double. False ✗ - A.
More GATE PYQ on Trees
All GATE CS Programming & Data Structures PYQ →Attempt GATE CS 2026 Set 2 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →