What is Binary Search
Binary search in another word half interval search is an algorithm which finds position of specified input value i.e. search key inside array which is sorted by its key value. To perform binary search on array it’s mandatory to arrange in descending or ascending order. Every step binary algorithm compares search key value with key value of middle element in array. If keys matches then it means matching element found including its index/position that has been returned. Else if search key is less than middle element key then algorithm will repeats its action on sub array to left of middle element and will compare if search key is greater on sub array to right. Let’s say if remaining array to be searched is empty then key not found in array and special “not found” indication can be returned.
For more details: Please use this link: Binary Search