Sort for forward ranges

Xinok xinok at live.com
Thu Mar 8 15:37:37 PST 2012


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


More information about the Digitalmars-d mailing list