Comb Sort - Just As Good As Quick Sort
en.wikipedia.org
en.wikipedia.org
I'm a student there; it's neat to see an article about his creation pop up. :)
I'd guess that it probably performs about as well as Shell sort: hard to analyse, strongly dependent on the detail of how your increments are chosen, typically worse than O(n log n).
I usually think the wikipedia.org items on HN are just a silly waste of time (e.g, not news) but I do have to admit that this one got me. Neat algorithm. Hadn't heard of it prior and wouldn't have thought of it spontaneously.
Edit: I might be in the wrong here. I did some quick tests with this code (http://yagni.com/combsort/combsort.py) and did not find it to be much slower when data is a reversed range vs. sorted range. So much for that intuitive thought.
The comb sort is intuitively O(n²). The inner loop will run n - gap iterations, where gap starts at n / 1.25 and decrease toward 1. I think we can effectively count this as O(n).
The outer loop is more tricky, in the worst case it will run until n < 1.25^m (where m is number of iterations).
Edit: Just re-read the algorithm and I overlooked that the outer loop stops when gap is below one AND no swaps were performed, so the above is optimistic. I.e. it is very clearly O(n²) and if you want to be exact, it could actually be something like O(n × (n + log n)) (for a shrink factor of 2, to make it simple) — but more detailed study of the algorithm is required to arrive at the exact worst running time, as the “preprocessing” (where gap > 1 is going to affect how many swaps can be performed when gap = 1).