3 ms·
I agree - the best binary search algorithm is the one someone else wrote, preferably in the standard library of the language you are using. I've written binary
by nickcw 5y ago
I agree - the best binary search algorithm is the one someone else wrote, preferably in the standard library of the language you are using.
I've written binary search algorithms maybe a half a dozen times, and every time I get tripped up by some boundary condition or other and what is only a few lines of code takes a really long time to get exactly right for all the corner cases.
- mark-r 5y agoYou'd be surprised how often standard libraries can be broken. The integer overflow bug for binary search has been found in many of them.