What is Binary Search?
An efficient search algorithm that finds a target value in a sorted array by repeatedly dividing the search interval in half.
Binary search compares the target to the middle element. If smaller, search the left half; if larger, search the right half. Each step eliminates half the remaining elements, giving O(log n) time complexity — searching 1 million items takes at most 20 comparisons.
Prerequisites: the data must be sorted. Binary search is used in database index lookups, dictionary searches, and finding insertion points. Variations include lower/upper bound searches and bisection methods for continuous functions.