Hwo can i solved a binary search problam in c++
First arrange your array in ascending order.and keep the two variables one for starting index and one for last index
then check your number with center(center = (first index + last index))/2 element of array.
if it is lager then center element then set first index = center,
if smaller then last index = center
else you got the number..
156 views
Usually answered in minutes!
×