Which of the following statement(s) is/are TRUE for any binary search tree (BST) having n distinct integers?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2025 Set 1 · Q26
Time
Select all that applyOne or more correct
Solution
Official answer: A) The maximum length of a path from the root node to any other node is (n - 1).; B) An inorder traversal will always produce a sorted sequence of elements.
Binary Search TreesLet us analyze each statement for a binary search tree (BST) with distinct integers:
Statement (A) is TRUE: In a degenerate or skewed BST (where each node has at most one child), the tree structure becomes linear like a linked list. The path from the root node to the deepest node contains nodes, which corresponds to an edge count (path length) of . Thus, the maximum path length from the root to any other node is .
Statement (B) is TRUE: By definition of a BST, for any node , all keys in its left subtree are strictly less than 's key, and all keys in its right subtree are strictly greater. An inorder traversal visits the left subtree, the root, and then the right subtree, which recursively guarantees that elements are output in strictly ascending sorted order.
Statement (C) is FALSE: Finding an element in a balanced BST takes time, but in the worst case (a skewed BST), the search time is .
Statement (D) is FALSE: In a min-heap, the key of every node must be less than or equal to the keys of its children. However, in a BST, any non-empty left child has a key smaller than its parent, which violates the min-heap property.
Therefore, statements (A) and (B) are correct.
Try the question first, then check your work.
Examiner trap
Consider the properties of a skewed binary search tree to analyze the worst-case path length and search time. Recall how an inorder traversal visits BST nodes, and compare the parent-child relationships in a BST versus a Min-Heap.
This Binary Search Trees previous year question is Q26 of the GATE CSE 2025 Set 1 paper. Find more GATE CSE PYQs on Binary Search Trees in Programming and Data Structures, or browse all GATE CSE PYQs.
Free diagnostic
Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Binary Search Trees PYQs now with no account.
An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.
Binary Search Trees has 21 GATE CSE PYQs across 17 papers from 2011 to 2026. This is the only 1-mark MSQ among them, and it is the only one in GATE CSE 2025 Set 1.
How GATE tests Binary Search TreesIndependent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.