• 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 

     

  • 相关阅读:
    [译]6.1. Data Structures Featured in This Chapter 本章涉及到的数据结构
    Linux中进程结构描述符
    How to uninstall GRUB
    [每日一点]msgsnd函数代码跟踪
    开始从代码入手学习内核
    剖析MagicAjax
    Castle实践6-TypedFactory Facility
    移植MSPetShop3到Castle MonoRail -Model与DAL层的移植(AR)
    热血江湖外挂之【热血江湖自补器 Version 0.1】
    对 "闭包closure" 的一些见解
  • 原文地址:https://www.cnblogs.com/HaifengCai/p/4028588.html
Copyright © 2020-2023  润新知