Re: Quicksort



On Jan 7, 6:52 pm, "robertwess...@xxxxxxxxx" <robertwess...@xxxxxxxxx>
wrote:
On Jan 7, 12:17 am, Adak <adak_d...@xxxxxxxxxxxxx> wrote:

Not imo. I've tested an iterative version of Quicksort, and it was
just slightly faster. IMO it wasn't
worth the bother of ensuring that the stack space was adequate. Also,
the recursive version is a beauty.
The iterative version is certainly not.

Do you mean the fully recursive version of Quicksort, where both
partitions are sorted recursively, or the semi-recursive version where
only the smaller partition is sorted recursively, and the larger one
iteratively?

Stack size is unavoidably a problem with the fully recursive version,
unless, of course you can afford order N stack space.


Or your compiler guarantees to do tail-recursion elimination.
.