Which of the following statements is false?
2024
Which of the following statements is false?
- A.
The time complexity of binary search is O(log n).
- B.
A linear search requires a sorted list.
- C.
A binary search can operate only on a sorted list.
- D.
The time complexity of linear search is O(n).
Attempted by 81 students.
Show answer & explanation
Correct answer: B
It is not required to sort a list for linear search, while for binary search, a sorted list is required. Linear search does the searching work in O(n) time while binary search does the searching work in O(log n) time.