
The Midpoint Bug in Binary Search
An analysis of a subtle bug in Binary Search related to calculating the midpoint. I explain the cause of integer overflow when adding lowerBound and upperBound, how to fix it with midPoint = lowerBound + (upperBound - lowerBound) / 2, and share the history of this bug in Programming Pearls.