首页 > 其他 > 详细

comparison algorithm of sort

时间:2014-10-16 14:08:23      阅读:247      评论:0      收藏:0      [点我收藏+]

 

    /*Comparison sort
     * 
     |---------------------|-----|----------------|---------------|------|----------|
     |       Name          |Best | Average        |Worst          |Memory|Stable?   |
     |---------------------|-----|----------------|---------------|------|----------|
     |1 Insertion sort     |     |                |               |      |          |
     |---------------------|-----|----------------|---------------|------|----------|
     |   1.1 Insertion sort|n    | n*n            |n*n            |1     |stable    | 
     |   1.2 Shell sort    |n    | n*(logn)*(logn)|n*(logn)*(logn)|1     |not table |
     |---------------------|-----|----------------|---------------|------|----------|
     |2 Exchange sort      |     |                |               |      |          |
     |---------------------|-----|----------------|---------------|------|----------|
     |   2.1 Quick sort    |nlogn| nlogn          |n*n            |logn  |not stable|
     |   2.2 Bubble sort   |n    | n*n            |n*n            |1     |stable    |
     |   2.3 Cocktail sort |n    | n*n            |n*n            |1     |stable    |
     |   2.4 Odd-Even sort |n    | n*n            |n*n            |1     |not sable |
     |---------------------|-----|----------------|---------------|------|----------|
     |3 Selection sort     |     |                |               |      |          |
     |---------------------|-----|----------------|---------------|------|----------|
     |   3.1 Selection sort|n*n  | n*n            |n*n            |1     |not stable|
     |   3.2 Heapsort      |nlogn| nlogn          |nlogn          |1     |not stable|
     |---------------------|-----|----------------|---------------|------|----------|
     |4 Merge sort         |     |                |               |      |          |
     |---------------------|-----|----------------|---------------|------|----------|
     |   4.1 merge sort    |n    | nlogn          |nlogn          |n     |stable    |
     |---------------------|-----|----------------|---------------|------|----------|
     |5 Hybrid sort        |     |                |               |      |          |
     |---------------------|-----|----------------|---------------|------|----------|
     |   5.1 hybrid sort   |nlogn| nlogn          |nlogn          |nlogn |not stable|
     |---------------------|-----|----------------|---------------|------|----------|
     * 
     */

 

  

comparison algorithm of sort 

 

comparison algorithm of sort

原文:http://www.cnblogs.com/HaifengCai/p/4028588.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!