各种算法

排序方式                        时间复杂度                            空间复杂度                  稳定性        复杂性
 
              平均情况         最坏情况                最好情况
 
插入排序            O(n^2)            O(n^2)                   O(n)                  O(1)                         稳定           简单
                   
希尔排序            O(n^1.3)                                                                O(1)                         不稳定         较复杂
 
冒泡排序            O(n^2)            O(n^2)                   O(n)                   O(1)                         稳定            简单
 
快速排序            O(nlog2n)      O(n2)                   O(nlog2n)                O(nlog2n)                 不稳定         较复杂
 
选择排序            O(n^2)            O(n^2)                   O(n^2)               O(1)                         不稳定         简单
 
堆排序               O(nlog2n)      O(nlog2n)             O(nlog2n)                O(1)                         不稳定         较复杂
 
归并排序            O(nlog2n)      O(nlog2n)             O(nlog2n)                O(n)                         稳定            较复杂
 
基数排序            O(d(n+r))      O(d(n+r))             O(d(n+r))                O(r)                         稳定             较复杂
posted @ 2013-05-15 20:29  全绍辉  阅读(163)  评论(0编辑  收藏  举报