2 ms·
I have to say that the usual way of writing binary search recursively doesn't help break the problem down. It's already as broken down as it gets, and you're j
by FutureNerd 17y ago
I have to say that the usual way of writing binary search recursively doesn't help break the problem down. It's already as broken down as it gets, and you're just tweaking the single case. The loop version wins for clarity.
I think second runner-up is the recursive version where you use slices... does lisp have slices?
- eru 17y agoLoops are just special cases of recursion. And binary search is definitely not the right operation on linked lists. So even in Lisp you should use a different data structure if you want to do a binary search.