What is the best case runtime of linear search(recursive) algorithm on an…
2024
What is the best case runtime of linear search(recursive) algorithm on an ordered set of elements?
- A.
O(1)
- B.
O(n)
- C.
O(logn)
- D.
O(nx)
Attempted by 176 students.
Show answer & explanation
Correct answer: A
The best case runtime of linear search occurs when the target element is found at the first position of the array.
In this scenario, only one comparison is needed, resulting in constant time complexity.
Therefore, the best case runtime is O(1).