UGC NET Paper 2 (Computer Science)Moderate

The worst-case time complexity of binary search on n sorted elements is:

  1. A. O(n)
  2. B. O(n log n)
  3. C. O(1)
  4. D. O(log n)

Correct answer: D. O(log n)

Each step halves the search range, so the worst case is O(log n).

More UGC NET Computer Science and Applications questions

Exams that ask this topic