Which search algorithm generally has O(N) worst-case time complexity?
Options
- A. Binary search
- B. Linear search
- C. Interpolation search
- D. More than one of the above
- E. None of the above
Quiz Practice:
B. Linear search
Linear search has a worst-case time complexity of O(N). It examines elements sequentially until the target is found or the entire collection has been searched. Unlike binary search, linear search does not require the data to be sorted. Its best-case complexity is O(1), while its worst-case complexity is O(N). Binary search can reduce the search space by half at every step.