Quote:Original post by tsukinokazeThe wikipedia claim about the speed of Gnome sort is at best extroadinarily optimistic and bold.
I'm no sorting pro, so it's just a suggestion made from theory not praxis.
If it's almost sorted, how about gnome sort isn't that fast for those types of tasks?
Gnome Sort operates very much like Insertion Sort, except that it involves repeated swapping instead of what I would call a rotate, and it performs more comparisons because it often ignores much of what it has already determined to be sorted.
Here's some numbers to illustrate. This is 100 items, reverse sorted initially, which is the worse case.
Algorithm: Comparisons: Item Assignments:Insertion Sort 4950 5049Gnome Sort 9900 9900