zoukankan      html  css  js  c++  java
  • comparison algorithm of sort

     

        /*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 

     

  • 相关阅读:
    获取app下载链接
    查找文件的路径
    回忆基础:制作plist文件
    Ping++中的AlipaySDK和AlicloudUTDID冲突解决方案
    CocoaPods常用操作命令
    自签名配置HTTPS
    Instruments10 分析某个类中方法的执行时间
    iOS KVC/KVO
    iOS 系统架构及常用框架
    LINQ to SQLite完美解决方案
  • 原文地址:https://www.cnblogs.com/HaifengCai/p/4028588.html
Copyright © 2011-2022 走看看