What is the best case and worst case complexity of ordered linear search?
2025
What is the best case and worst case complexity of ordered linear search?
- A.
O(nlogn), O(logn)
- B.
O(logn), O(nlogn)
- C.
O(n), O(1)
- D.
O(1), O(n)
Attempted by 112 students.
Show answer & explanation
Correct answer: D
Answer: d
Explanation: In ordered linear search, the best case occurs when the target element is found at the first position, requiring only one comparison. This results in a time complexity of O(1). The worst case occurs when the target is at the last position or not present in the array, requiring n comparisons. This results in a time complexity of O(n).