Binary Search

“Binary search is one of the most powerful ideas in algorithm design.” — Steven S. Skiena, The Algorithm Design Manual This piece is about the profound importance of a relatively simple algorithm, binary search. It’s a story of how binary search (and more generally, functions with logarithmic time complexity) can performantly search extremely large datasets. The implementation code is in Swift, although the principles generalize across languages. Say you were handed a phonebook of Gotham (hypothetical population one million) and asked to find the name Ron Swanson....

September 17, 2019 · 6 min · Me