3 ms·
I'd guess it is generally O(n log n) for random data, but not mathematically. At least seems to me that an for an inverted range (n, n-1, n-2, ... 0) the algori
by asmosoinio 17y ago
I'd guess it is generally O(n log n) for random data, but not mathematically. At least seems to me that an for an inverted range (n, n-1, n-2, ... 0) the algorithm will come down to O(n^2). I could be wrong though, didn't really think about it for that long.
Edit: I might be in the wrong here. I did some quick tests with this code (http://yagni.com/combsort/combsort.py 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.
- deleted 17y ago[deleted]