Sorting algorithms benchmark

Deewiant deewiant.doesnotlike.spam at gmail.com
Tue Mar 6 10:39:00 PST 2007


Stewart Gordon wrote:
> Deewiant Wrote:
>> Your comb sort uses a shrink factor of 0.7.  Comb sort 11 uses 
>> 1 / (1 - 1 / (e ^ phi)), where e is Napier's constant and phi 
>> the golden ratio.  This leads to possible optimization in the 
>> algorithm.
> 
> Hang on - isn't 0.7 a grow factor, rather than a shrink factor?

I took a more detailed (but still quite cursory) look at your code, and it seems
you do things differently from the "traditional" method. I'm not sure if that's
even equivalent to the normal comb sort.

But yes, since 0.7 is less than 1, I suppose you could call it a grow factor. It
still shrinks the size of the gap you're looking at, though. Up to you, but all
references to comb sort I've seen talk about shrink factors. :-)

>> Other sorts that could be added:
>> 	- Gnome sort, http://en.wikipedia.org/wiki/Gnome_sort
> 
> Not sure if this one is worth it....

It's only a few lines of code, so there's not much to be worth. And at least
it's faster than bubble sort. ;-)

-- 
Remove ".doesnotlike.spam" from the mail address.



More information about the Digitalmars-d-announce mailing list