Re: Quicksort
- From: CBFalconer <cbfalconer@xxxxxxxxx>
- Date: Tue, 08 Jan 2008 01:52:04 -0500
"robertwessel2@xxxxxxxxx" wrote:
"robertwess...@xxxxxxxxx" <robertwess...@xxxxxxxxx> wrote:
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.
That won't normally control the recursion depth, since each level
has to depend on the relative size of the segments. It is
trivially easy to do it yourself, and ensure the depth never
exceeds ln2(size).
--
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
.
- Follow-Ups:
- Re: Quicksort
- From: robertwessel2@xxxxxxxxx
- Re: Quicksort
- References:
- Quicksort
- From: Roman Töngi
- Re: Quicksort
- From: Adak
- Re: Quicksort
- From: robertwessel2@xxxxxxxxx
- Re: Quicksort
- From: robertwessel2@xxxxxxxxx
- Quicksort
- Prev by Date: Re: Quicksort
- Next by Date: Re: Quicksort
- Previous by thread: Re: Quicksort
- Next by thread: Re: Quicksort
- Index(es):
Relevant Pages
|