Which of the following statements is false?

2024

Which of the following statements is false?

  1. A.

    The time complexity of binary search is O(log n).

  2. B.

    A linear search requires a sorted list.

  3. C.

    A binary search can operate only on a sorted list.

  4. 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.

Explore the full course: Coding For Placement