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.

Related Posts
Discover more content you might enjoy

Accidentally Building a Blogging Platform
I hadn't written blog posts for a long time and realized I was too dependent on AI. To rebuild my writing habit and think more clearly, I decided to build a writing platform: write.rocks.

Vibe Coding - Rebuilding My Blog from Scratch and Rebranding to khoa.blog
Detailed walkthrough of rebuilding a blog from scratch with vibe coding, from data migration to implementing new features, helping readers understand the personal blog development process.

Contrarian Thinking in the AI Era
Exploring contrarian thinking in an era where everyone is rushing into AI, examining niche opportunities in fintech and crypto payments that could provide sustainable long-term value.

Game Theory in the AI Era: When Machines Join the Game
An analysis of the intersection between Game Theory and artificial intelligence, explaining how AI is changing Nash equilibrium principles and optimal strategies. The post includes real-world examples of applications in business, transportation, and cybersecurity.

The Pathos Problem in Startups
Analysis of the Pathos Problem in startups - when founders have oversized egos and seek validation instead of listening to real feedback.
A "Super Fast" Vocabulary Learning Method
An effective English vocabulary learning method that combines words, images, sounds, and actions to activate both brain hemispheres, helping you memorize quickly and retain longer.