niviki.com
HomeBlogCategoriesSeriesCoursesAboutRSS
niviki.com

Sharing technology & financial freedom. Learn from failure. Build with passion. Share from heart.

Navigation

HomeBlogCategoriesSeriesServerCompassReadimaStoicSoft1DevTool1FileTool

Resources

CoursesAboutRSS FeedGitHubtoidicodedao.comlaptrinhcuocsong.comHowVibeCode.com

© 2026 niviki.com. All rights reserved.

Contact

algorithms-data-structures

All posts in the algorithms-data-structures category

The Midpoint Bug in Binary Search
January 21, 2017•3 min read•
Programming & Tech+1

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.