The time complexity of binary search on a sorted array of n elements is:

2025

The time complexity of binary search on a sorted array of n elements is:

  1. A.

    O(n)

  2. B.

    O(n log n)

  3. C.

    O(log n)

  4. D.

    O(1)

Attempted by 54 students.

Show answer & explanation

Correct answer: C

Binary search halves the search interval at every step, so its time complexity on a sorted array is O(log n).

Explore the full course: Coding For Placement