GateAI
Binary Search Trees

GATE CSE 2025 Set 1 · Q26

MSQ1 markEasy

Time

Which of the following statement(s) is/are TRUE for any binary search tree (BST) having nn distinct integers?

Select all that applyOne or more correct

Pick every correct option

Solution

Step-by-step verified 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 Trees

Let us analyze each statement for a binary search tree (BST) with nn 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 nn nodes, which corresponds to an edge count (path length) of n−1n - 1. Thus, the maximum path length from the root to any other node is n−1n - 1.

  • Statement (B) is TRUE: By definition of a BST, for any node xx, all keys in its left subtree are strictly less than xx'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 O(log⁡2n)O(\log_2 n) time, but in the worst case (a skewed BST), the search time is O(n)O(n).

  • 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.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

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

Where do you stand for GATE?

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.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Binary Search Trees in GATE CSE

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 Trees

More from GATE CSE 2025 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2025 Set 1 · Q26 · MSQ

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

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.