GATE CS 2026 Set 1 | Question 40
Programming & Data Structures › Trees · MCQ · 2 marks · Answer: D
- Question 40Programming & Data Structuresmcq2 marksLet be the set of all integers from 1 to 15. Consider any order of insertion of the elements of into a binary search tree that creates a complete binary tree. Which one of the following elements can NEVER be the third element that is inserted?
- A.4
- B.2
- C.10
- D.5✓
Answer: D
Solution
Answer: (D) 5 Fifteen keys in a complete BST have a fixed shape: the root is 8, level 1 is {4, 12}, and level 2 is {2, 6, 10, 14}. A node can be inserted only after its parent. So 8 goes first, then 4 or 12 second, and the third is the other of 4/12 or a child of the second (2, 6, 10 or 14). 5 is on level 3 and needs 8, 4 and 6 before it. It can never be third.
- A.
More GATE PYQ on Trees
All GATE CS Programming & Data Structures PYQ →Attempt GATE CS 2026 Set 1 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →