Aspire's Library

A Place for Latest Exam wise Questions, Videos, Previous Year Papers,
Study Stuff for MCA Examinations - NIMCET

Previous Year Question (PYQs)



In a binary search tree, the worst case time complexity of inserting and deleting a key is:





Solution

Insertion: To insert, we first locate the correct position. This requires searching the tree = height \(h\). Worst case: tree is skewed (\(h=n\)) → \(O(n)\).

Deletion: To delete, we also search for the node (\(O(h)\)) and adjust pointers (constant). Worst case: \(h=n\). So, time = \(O(n)\).

✅ Therefore: \[ \text{Insertion: } O(n), \quad \text{Deletion: } O(n) \]


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More


Online Test Series,
Information About Examination,
Syllabus, Notification
and More.

Click Here to
View More

Ask Your Question or Put Your Review.

loading...