Question 23

Computer Awareness Trees Easy

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

(A) \( O(lg n) \) for insertion and \(O(lg n)\) for deletion
(B) \( O(n) \) for insertion and \( O(lg n) \) for deletion
(C) \( O(n) \) for insertion and \( O(n) \) for deletion
(D) \( O(lg n) \) for insertion and \( O(n) \) for deletion
✓ Correct Answer: Option C Verified Solution

📘 Step-by-Step Solution & Detailed Explanation:

Solution:

For a Binary Search Tree (BST), time complexities depend on the height \(h\) of the tree. - In the worst case (when the BST is completely unbalanced, e.g. degenerates into a linked list), the height \(h = n\). - Most basic BST operations (search, insertion, deletion) take time proportional to the height, i.e. \(O(h)\).

Insertion: We search from the root to the correct leaf position and insert — cost \(O(h)\). In worst case \(h = n\) ⇒ insertion \(\;=\; O(n)\).

Deletion: We locate the node (cost \(O(h)\)) and may need to find its in-order successor/predecessor (again up to \(O(h)\)) and adjust pointers — overall \(O(h)\). In worst case \(h = n\) ⇒ deletion \(\;=\; O(n)\).

✅ Correct Answer: (C) \(O(n)\) for insertion and \(O(n)\) for deletion

Practice Similar Trees Questions

Reinforce your conceptual grasp with related questions from CUET-MCA 2025:

Q4 In case of Binary search tree which of the following procedure's running...
Solve →
Q1 Match List-I with List-II |c|l| List-I & List-II \\ (A)\ Seek Time & (I)\...
Solve →
Q7 External fragmentation occurs
Solve →
Q9 In the search time is independent of the number of elements n.
Solve →
Q11 A situation where two or more processes are blocked, waiting for resources...
Solve →
Full-Length Test Series

Prepare for CUET-MCA Under Real Exam Conditions

Take timed full-length mock tests with authentic question distributions, negative marking (+12/-3 in Math), and instant All India Rank calculation.

Start Free Mock Test Series →