Binary Search

A binary search algorithm finds the position of a specified input value within an array sorted by values. The sorted array space is repeatedly cut in half according to how the required value compares with the middle element. The figure below explains this algorithm with an example to find value t = 11 from a sorted array A.

Figure 1. Binary Search