Data Structures | Binary Search Trees | Question 1
What is the worst case time complexity for search, insert and delete operations in a general Binary Search Tree?
(A) O(n) for all
(B) O(Logn) for all
(C) O(Logn) for search and insert, and O(n) for delete
(D) O(Logn) for search, and O(n) for insert and delete
Answer: (A)
Explanation: In skewed Binary Search Tree (BST), all three operations can take O(n). See the following example BST and operations.
10
/
20
/
30
/
40
Search 40.
Delete 40
Insert 50.
Recommended Posts:
- Data Structures | Binary Search Trees | Question 2
- Data Structures | Binary Search Trees | Question 8
- Data Structures | Binary Search Trees | Question 12
- Data Structures | Binary Search Trees | Question 10
- Data Structures | Binary Search Trees | Question 12
- Data Structures | Binary Search Trees | Question 12
- Data Structures | Binary Search Trees | Question 4
- Data Structures | Binary Search Trees | Question 7
- Data Structures | Binary Search Trees | Question 5
- Data Structures | Binary Search Trees | Question 6
- Data Structures | Binary Search Trees | Question 3
- Data Structures | Balanced Binary Search Trees | Question 13
- Data Structures | Balanced Binary Search Trees | Question 13
- Data Structures | Balanced Binary Search Trees | Question 11
- Data Structures | Balanced Binary Search Trees | Question 12



