GATE 2015 CS – Question 35
What are the worst-case complexities of insertion and deletion of a key in a binary search tree?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (B) $\Theta(n)$ for both insertion and deletion
Explanation
A binary search tree is not guaranteed to be balanced. In the worst case it becomes a chain of $n$ nodes, so both finding the place to insert and finding the node to delete take $\Theta(n)$.