GateAI
Binary Search Trees

GATE CSE 2013 · Q7

MCQ1 markEasy

Time

Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of nn nodes?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: C) O(n)

Binary Search Trees

The time complexity of inserting an element into a binary search tree (BST) is proportional to the height hh of the tree, i.e., O(h)O(h).

  • In the best/average case (balanced BST), h=O(log⁡n)h = O(\log n).

  • In the worst case (skewed BST), where elements are inserted in strictly ascending or descending order, the height of the tree becomes h=nh = n, resulting in a time complexity of O(n)O(n).

Since an upper bound must account for the worst-case scenario across all binary search trees of nn nodes, the tightest upper bound is O(n)O(n) (Option C).

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 Q7 of the GATE CSE 2013 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 GATE CSE 2013 has 2.

How GATE tests Binary Search Trees

More from GATE CSE 2013

Share this solution

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

GateAI solution cardGATE CSE 2013 · Q7 · MCQ

Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of n nodes?

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.