GATE / CS ARCHIVE

GATE CSE 2025 SET 1 / QUESTION 26

Distinguishing BST guarantees from worst-case bounds

Data Structures · Binary Search & Balanced Trees · Full GATE CSE 2025 Set 1 paper

GATE 2025 Set 1, Q26 1 mark · MSQ
Report issue

Binary Search & Balanced Trees

Question 26, GATE 2025: For a BST storing n distinct integers, assess: A “The maximum length of a path from the root node to any other node is (n−1).” B inorder traversal is always sorted. C worst-case search takes O(log₂ n). D every BST is a Min-Heap. Select all true statements. A’s wording is retained because it has a material quantifier ambiguity.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A, B

Our answer: A;B under upper-bound interpretation; B under literal per-tree equality

Approach: Separate guarantees for every individual tree from the largest possible height among all n-node BSTs.
Inorder traversal visits the left subtree, root, then right subtree. By the BST ordering invariant all left keys are smaller and all right keys are larger. Applying that reasoning recursively produces sorted order, so B is unconditionally true.
Any root-to-node path contains at most n nodes, hence at most n−1 edges. A completely skewed BST attains this bound. Under the intended “maximum possible over all BSTs” interpretation, A is true and the official answer is A,B. Literally, however, A says that each tree’s maximum root path IS n−1. A balanced three-node BST has height 1 rather than 2, so under that reading A is false and only B survives.
C is false because search follows a root-to-node path and may take Θ(n) in a skewed BST; balancing is not promised. D is false because a BST need not be complete, and its left child can be smaller than its root, violating min-heap order.
Keep the official A;B for scoring while explicitly warning about A’s wording. The mathematical distinction must not be hidden by replacing “is” with “at most”.

Original paper, page 26 · Answer key