Tony Hoare, the British computer scientist who gave us both one of the most elegant algorithms in computer science and one of its most persistent bugs, has passed away at 92. He created Quicksort—still the default sorting algorithm in most programming languages—and the null reference, which he later called his "billion-dollar mistake."
That combination of brilliance and humility defined Hoare's career. How many people can claim to have fundamentally shaped modern computing twice, in completely opposite ways? Quicksort is taught in every CS curriculum as an example of algorithmic elegance. Null pointer exceptions are cursed by every developer who's ever debugged a production crash at 3 AM.
Quicksort emerged from a bet. According to tributes posted after his death, Hoare wagered his boss at Elliott Brothers Ltd that he could devise a faster sorting method. He won that bet, and the algorithm he created became one of the most widely used in computer science. Sixty years later, it's still the go-to choice for general-purpose sorting because its average-case performance is hard to beat.
The algorithm's elegance comes from its simplicity: pick a pivot element, partition the array around it, and recursively sort the partitions. Three lines of pseudocode that translate into highly efficient machine code. It's the kind of solution that seems obvious in retrospect but took genuine insight to discover.
Then there's the null reference. Hoare introduced it in ALGOL W in 1965 because it was easy to implement. Decades later, he publicly regretted it, calling it a billion-dollar mistake for all the bugs, system crashes, and security vulnerabilities it enabled. That level of public self-reflection from a Turing Award winner is rare and admirable.
The irony is that null references remain ubiquitous. Modern languages have tried to fix the problem—Rust's Option type, Kotlin's null safety, Swift's optionals—but billions of lines of code still use null in ways that cause runtime crashes. Hoare's will probably outlive all of us.
