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.

Day 28-29-30 - Profitable MVP in 30 Days - All According to Plan
Days 28-29-30 of the profitable MVP challenge where I look back at the original plan and assess progress. Sharing how I plan to hit the $1000 profit goal by buying my own app, and announcing the new app Focusify.app instead of letmethink. Also preparing landing page, promo video, and images for launch day.

Why You Should Get an International Payment Card
An introduction to the benefits of owning an international payment card like Visa and MasterCard, including cross-continental payment capability, online shopping on international platforms, signing up for PayPal and other e-wallets, along with basic guidance on how to get a card at ACB bank at reasonable cost.