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
GATE CSE 2013 · Q7
Time
Select one answerSingle correct
Solution
Official answer: C) O(n)
Binary Search TreesThe time complexity of inserting an element into a binary search tree (BST) is proportional to the height of the tree, i.e., .
In the best/average case (balanced BST), .
In the worst case (skewed BST), where elements are inserted in strictly ascending or descending order, the height of the tree becomes , resulting in a time complexity of .
Since an upper bound must account for the worst-case scenario across all binary search trees of nodes, the tightest upper bound is (Option C).
Try the question first, then check your work.
Examiner trap
Consider the worst-case scenario where the binary search tree is completely skewed (like a linked list).
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
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. 8 of them are 1-mark MCQs like this one, and GATE CSE 2013 has 2.
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.