3 ms·
what if max is already overflown due to size of array (without even doing the lo + high calculation?) Then min + (max- min)/2 would be min + (smaller negative
by nomy99 6y ago
what if max is already overflown due to size of array (without even doing the lo + high calculation?) Then
min + (max- min)/2 would be min + (smaller negative value) which would violate the min + (max-min)/2 <= max
- pk86 6y agoAssuming the value of max passed in is "sane" (non-negative and within array bounds), it is strictly decreasing and should never overflow.