4 ms·
It is trivial to write a binary sort using a single iterating loop instead of using recursion. This is not true for quicksort which needs to maintain a bit of s
by VanillaCafe 13y ago
It is trivial to write a binary sort using a single iterating loop instead of using recursion. This is not true for quicksort which needs to maintain a bit of state generally on the stack via recursion. Basically it is a false start to try to optimize binary search's recursion since it is so easy to remove completely.