What are the worst-case complexities of insertion and deletion of a key in a binary search tree?
Topic-wise GATE CS PYQs with verified steps
GATE CSE 2015 Set 1 · Q23
Time
Select one answerSingle correct
Solution
Official answer: B) (n) for both insertion and deletion
Binary Search TreesIn a standard (unbalanced) Binary Search Tree (BST) with nodes, the time complexity of search, insertion, and deletion operations is proportional to the height of the tree, .
In the worst case, the BST becomes skewed (a degenerate tree where each node has at most one child). In this case, the height of the tree is:
Therefore:
Insertion: Traversing to the correct leaf position in a skewed tree takes time.
Deletion: Searching for the node to delete and/or finding its inorder successor/predecessor takes time.
Thus, the worst-case time complexity is for both insertion and deletion, which corresponds to option (B).
Try the question first, then check your work.
Examiner trap
Consider the shape of an unbalanced binary search tree in the worst-case scenario (a skewed tree).
This Binary Search Trees previous year question is Q23 of the GATE CSE 2015 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
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 2015 Set 1 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.