GateAI
Binary Search Trees

GATE CSE 2021 Set 1 · Q10

MCQ1 markEasy

Time

A binary search tree TT contains nn distinct elements. What is the time complexity of picking an element in TT that is smaller than the maximum element in TT?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: D) (1)

Binary Search Trees

Let TT be a binary search tree with n≥2n \ge 2 distinct elements with root RR.

We need to find any element that is strictly smaller than the maximum element in TT:

  1. If RR has a left child (or left subtree): Any node in the left subtree is smaller than RR. Therefore, the left child of RR is strictly smaller than RR, which means it must be strictly smaller than the maximum element of TT.

  2. If RR does not have a left child: Since n≥2n \ge 2, RR must have a right child. All nodes in the right subtree are strictly greater than RR. Thus, RR is strictly smaller than all elements in its right subtree, including the maximum element.

In either case, we only need to inspect the root and potentially its left child, which takes a constant number of operations: Θ(1)\Theta(1).

Therefore, the time complexity is Θ(1)\Theta(1) (Option D).

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 Q10 of the GATE CSE 2021 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. 8 of them are 1-mark MCQs like this one, and it is the only one in GATE CSE 2021 Set 1.

How GATE tests Binary Search Trees

More from GATE CSE 2021 Set 1

Share this solution

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

GateAI solution cardGATE CSE 2021 Set 1 · Q10 · MCQ

A binary search tree T contains n distinct elements. What is the time complexity of picking an element in T that is smaller than the maximum element in T?

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.