Binary Search





Binary search is the most common algorithm in the search concept and how do binary search work? This is the main concept,Binary search works with lowerbound and upperbound, such as it is mandatory for the target array to be sorted.

img

after we will get middle,like image, If the middle value and the search value match We will return the position of the element, If the value does not match the lower value or the upper value is swap with the middle value, And loops are doing the same thing again,