Related Articles

Related Articles

GATE | GATE-CS-2015 (Set 1) | Question 33
  • Last Updated : 19 Feb, 2015

What are the worst-case complexities of insertion and deletion of a key in a binary search tree?
(A) Θ(logn) for both insertion and deletion
(B) Θ(n) for both insertion and deletion
(C) Θ(n) for insertion and Θ(logn) for deletion
(D) Θ(logn) for insertion and Θ(n) for deletion

Answer: (B)

Explanation: The time taken by search, insert and delete on a BST is always proportional to height of BST. Height may become O(n) in worst case.

Quiz of this Question


My Personal Notes arrow_drop_up
Recommended Articles
Page :