Posted by Joshua Bloch, Software Engineer I remember vividly Jon Bentley's first Algorithms lecture at CMU, where he asked all of us incoming Ph.D. students to write a binary search, and then dissected one of our implementations in front of the class. Of course it was broken, as were most of our implementations. This made a real impression on me, as did the treatment of this material in his wonder
![Official Google Research Blog: Extra, Extra - Read All About It: Nearly All Binary Searches and Mergesorts are Broken](https://cdn-ak-scissors.b.st-hatena.com/image/square/dbd55ab0448c50716670c90c91b4abc554bb62fd/height=288;version=1;width=512/https%3A%2F%2Fresearch.google%2Fstatic%2Fimages%2Fblog%2Fgoogle-ai-meta.png)