The past few days I've posted some sorting routines customized to the tasks they were required to solve. Since I have a bunch of different sorting routines already coded, I decided to post them.
Please note that some of these sorts are fast, but not a single one is as fast as the built in Array.Sort due to these using managed code while I suspect Array.Sort uses pointers and unmanaged code.
The snippet above is the base class I use for all the sort routines to ensure that they are interchangeable. All the routines are generic sorts and will sort any array of types as long as the type implements IComparable.
Just to give some idea on how fast the various sorts are, here are some timings on sorting 20,000 integers. Times given in milliseconds:
Selection... - 3961
Insertion... - 2308
Quick....... - 20
Odd-Even.... - 4388
Gnome....... - 4527
Comb........ - 35
Cocktail.... - 3504
Bubble...... - 4892
Heap........ - 30
Shell....... - 26
Array.Sort.. - 5