News for hackers. Stuff that matters.
Re:Binary Search Reconsidered (2018) by nomy99 on Friday December 25, 2020 @01:11PM (#25538004)
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
Re:Binary Search Reconsidered (2018) by pk86 on Friday December 25, 2020 @01:35PM (#25538126)
Assuming the value of max passed in is "sane" (non-negative and within array bounds), it is strictly decreasing and should never overflow.