(Improved) Benchmark for Phobos Sort Algorithm

BCS anon at anon.com
Sat Dec 18 08:46:51 PST 2010


Hello Craig,

> It was brought to my attention that the quick sort has a very bad
> worst case, so I implemented a simple fix for it.  Now the worst case
> (completely ordered) is the best case, and it only slows down the
> general case by a small percentage.  I thought to myself, "it can't be
> this easy to fix quick sort".  Does anyone see a flaw in this simple
> fix?  Performs much better than Phobos in completely random and
> completely sorted data.  Perhaps there is another case where it
> doesn't do as well?
> 

I think I've seen it stated as: If you know the implementation, you can always 
generate a pathological case for QSort.




More information about the Digitalmars-d mailing list