Which of the following statement(s) is/are TRUE for any binary search tree…

2025

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

  1. A.

    The maximum length of a path from the root node to any other node is \((𝑛 − 1)\).

  2. B.

    An inorder traversal will always produce a sorted sequence of elements

  3. C.

    Finding an element takes \(𝑂(log_2 𝑛)\) time in the worst case.

  4. D.

    Every BST is also a Min-Heap.

Attempted by 168 students.

Show answer & explanation

Correct answer: A, B

Correct statements for any binary search tree (BST) with n distinct integers:

  • The maximum length of a path from the root node to any other node is n−1.

  • An inorder traversal will always produce a sorted sequence of elements.

Why these are true:

  • Maximum path length equals n−1 because in the most unbalanced case the BST degenerates into a single chain (each node has only one child), so the longest root-to-node path visits all other nodes. Note: this counts edges; counting nodes would give n.

  • Inorder traversal visits left subtree, then the node, then right subtree recursively. The BST property (all left subtree keys < node key < all right subtree keys) ensures the visited sequence is in ascending order.

Why the other statements are incorrect:

  • Finding an element takes O(log n) time only in balanced BSTs. In the worst case (an unbalanced BST that is a chain) search degrades to O(n).

  • A BST is not necessarily a min-heap. A min-heap requires each parent to be ≤ its children, which is a different constraint. A BST can have a parent larger than a descendant in the right subtree's left branch, so it may violate the heap property (for example a node with key 15 can have a descendant with key 12).

Final answer: The true statements are the ones about the maximum path length being n−1 and that inorder traversal produces a sorted sequence. The time-complexity statement is only true for balanced BSTs, and the min-heap statement is false.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir