A binary search function is searching for a value that is stored in the middle element of an array. How many times will the function read an element in the array before finding the value?
A binary function is also known as a half-interval search is a search algorithm to find the position of a given element x within a well-sorted array [].
Binary search compares the target value to the middle element of the array.
It ignores half of the elements just after one comparison.
it compares x with the middle element.
So, the function read an element one time in the array before finding the value.