Which condition is necessary for applying binary search efficiently on an array?

Options

  • A. The array must be sorted
  • B. The array must contain only positive numbers
  • C. The array must contain unique elements only
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

A. The array must be sorted

Detailed Explanation

The primary requirement for conventional binary search is that the elements must be arranged in sorted order. The algorithm compares the target with the middle element and decides whether to search the left or right half. Duplicate elements are allowed, and values do not have to be positive. However, without sorted data, the algorithm cannot safely eliminate half of the search space after each comparison.