I just watched the short for binary search and I'm having trouble understanding how making a conditional of (max < min) would mean that the number is not in your array (timestamp 04:05). I get that if max was less than min then the list is not sorted properly, but they were saying that if max is less than min, "you went too far." Why does (max < min) mean that the number is not in your list? Thanks!
in case we have a single element left in the array,
min would be equal. the midpoint is calculated, and we check whether
array[midpoint] is equal to the value we're looking for.
if the previous condition is not true, namely
array[midpoint] is NOT equal to the value we're looking for, the algorithm still proceeds further and either sets
max to a lower value or sets
min to a greater value. in either case
max would be less than
min (see why?).
in the next iteration/recursive call we wouldn't wanna proceed further than that because we would have no elements in the array left to check against.