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