排序算法-交换排序算法效率测试

前几篇文章介绍了几种交换排序的算法。

冒泡排序

快速排序

奇偶排序

鸡尾酒排序

Gnome sort

Comb sort

 

 

下面是对一个随机序列的排序效率结果:
test1:
quicksort time:         0.10864 ms
bubblesort time:        5.83652 ms
cocktail time:          6.13016 ms
comb sort time:         1.38076 ms
gnome sort time:        4.38388 ms
odd-even sort time:     6.846 ms

test2:
quicksort time:         0.1225 ms
bubblesort time:        5.35685 ms
cocktail time:          5.53548 ms
comb sort time:         0.22765 ms
gnome sort time:        4.10683 ms
odd-even sort time:     6.7337 ms

test3:
quicksort time:         0.11808 ms
bubblesort time:        5.49997 ms
cocktail time:          5.32455 ms
comb sort time:         0.20061 ms
gnome sort time:        4.66813 ms
odd-even sort time:     7.18163 ms

你可能感兴趣的:(排序算法)