The worst case complexity for searching an element in binary search tree is…
2018
The worst case complexity for searching an element in binary search tree is _____.
- A.
O(log n)
- B.
O(n log n)
- C.
O(n²)
- D.
O(n)
Attempted by 1391 students.
Show answer & explanation
Correct answer: D
A Binary Search Tree (BST) allows efficient searching when it is balanced. However, in the worst case, the BST can become skewed (like a linked list), for example when elements are inserted in sorted order. In that case, searching may require traversing all n nodes, so the worst-case time complexity is O(n).