What is the best-case time complexity of binary search?

Options

  • A. O(1)
  • B. O(log N)
  • C. O(N)
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. O(1)

Detailed Explanation

The best-case time complexity of binary search is O(1). This occurs when the target element is found in the very first comparison, which means the middle element of the sorted array is the required element. Although the average and worst cases require O(log N) comparisons, the best case requires only one comparison. Understanding best, average, and worst-case complexity is important in algorithm analysis.