Binary search is one of these algorithms.
Binary search requires that the array to be searched is sorted, preferably in ascending order.
The main idea of binary search is to divide the array into two equal parts and narrow down the range of the array to be searched either to the low part of the array or high part of the array. Keep doing this until the value is located, or until we realize that the value searched for is not in the array. While sequential search does not require that the array to be searched is sorted, it is much less efficient when the array is sorted. We will start up by examining a program using sequential search and then move on to binary search. Compile and run the sample program provided.