Binary search algorithm

In computer science, binary search is a search algorithm that finds the position of a target value within a sorted array. Binary search begins by comparing an element in the middle of the array with the target value. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining...