DN> Hi Mathieu,
DN> MB>Still, i think the canonical implementation of qsort() is made using
DN> MB>the QuickerSort algorithm.
DN> I suspect you are right. I, for one, would be too ashamed to release a
DN> standard library that used bubble sort.
DN> MB>BTW, would someone point out to me the difference between the
DN> QuickSort and the QuickerSort ?
DN> The usual Quickersort incorporates Hoare's suggestion of using insertion
DN> sort for shorter subfiles within Quicksort. And here is the code.
I expected more than this :-) the idea is old news for me. I didn't
know quickersort was just that. That kind of improvement can be done on
lots of sorts. I usually use bubblesort for that kind of thing. :-)
DN>
===============================quicksrt.hpp=================================
DN> // Templates for Hoare's algorithm for ascending & descending sort.
DN> // Note that this is Hoare's original, recursive algorithm with an
DN> // insertion sort for shorter subfiles.
there are probably lots of more optimal versions of this now, i guess.
i found a version that doesn't really "exchange"; i found it was faster
on completely random arrays, but not that good elsewhere; there could
be improvements on the top of it that could make it better in most
useful cases than the classic quickersort.
matju
--- Terminate 4.00/Pro
---------------
* Origin: The Lost Remains Of SatelliteSoft BBS (1:163/215.42)
|