www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Sort for forward ranges

This is a simple library I wrote for sorting forward ranges. It's 
an in-place unstable sort which uses a combination of quick sort 
and comb sort. It's about 2-3x slower than the Phobos unstable 
sort.

The down side of using quick sort is choosing a pivot. Rather 
than walk the range to do a median-of-three or other trick, I 
simply use the first element as the pivot. Instead, the code will 
fall back to comb sort to avoid the worst-case of quick sort.

http://www.mediafire.com/?yy8p5xzg8ka38rd
Mar 08 2012