The other day I had to sort a rather large array. I could have used the wellknown quicksort-method, but then I remembered the combsort-method. (Unfortunately I can not remember, who has made this exellent sorting algorithm). Combsorting is very simple to implement and it is comparable in speed to quicksort, but is is not known by very many programmers.
Below is a VBscript-program where you can compare combsort to bobblesort. On my Thinkpad 570 I got the folowing results:
Number of elements to sort: |
Combsort |
Bubblesort |
1000 |
0.25 sec |
5.6 sec |
1500 |
0.4 sec |
12.0 sec |
10000 |
3.4 sec |
n/a |
20000 |
7 sec |
n/a |
40000 |
17 sec |
n/a |
60000 |
26 sec |
n/a |
It is only the procedure CombSort, which is interesting. The rest is just to make it possible to measure the performance.