For the basics, I wrote a bunch of stuff about sorting. It seems worth taking a moment

to talk about something related: binary search. Binary search is one of the most important

and fundamental algorithms, and it shows up in sorts of places.

It also has the amazing property that despite being simple and ubiquitous, it's virtually

*always* written wrong. There's a bit of subtlety in implementing it correctly, and virtually

everyone manages to put off-by-one indexing errors into their implementations. (Including me; last time I implemented a binary search, the first version included one of the classic errors.) The errors are so ubiquitous that even in a textbook that discusses the fact that most programmers get it wrong, they *got it wrong* in their example code!