Apr 18, 2026
Does a binary search algorithm require the input array to be sorted in order to work correctly?
Pending
Answer
Yes. Binary search repeatedly halves the search space by comparing the target to the middle element, which only works if the elements are in sorted order.