Bitwise binary search

Binary search is notoriously difficult to get correct. A 1988 study found that out of an informal sample of twenty computer science textbooks, only five contained a correct binary search algorithm. I haven’t checked, but I hope we are doing better now in 2022. Unfortunately off-by-one errors feel rather timeless to me. - Elegant and Fast

Written on September 28, 2023, Last update on October 9, 2024
search bits