2011-08-02 69 views
-1

可能重複:
What sort algorithm provides the best worst-case performance?哪一種排序方式最好?

這是可以用來排序整數數組最好的方法是快速排序效率? 用於排序的一些常用方法在[已刪除垃圾郵件鏈接]中提到

+0

重複:http://stackoverflow.com/questions/220044/which-sort-algorithm-works-best-on-mostly-sorted-data http://stackoverflow.com/questions/773253/what -sort算法,提供最最好的最壞情況下的性能 – gideon

回答

1

它們是不同的排序方法可用於不同的功能。

Bubble Sort [It's simple but not good for large data][1] 

Selection Sort [Selection sort is noted for its simplicity, and also has performance advantages over more complicated algorithms in certain situations, particularly where auxiliary memory is limited.][2] 

Insertion Sort [It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort, or merge sort.][3] 

Quick Sort [Quicksort is often faster in practice than other O(nlogn) algorithms][4] 

Merge Sort [Merge sort is an O(n log n) comparison-based sorting algorithm][5] 

Heap Sort [it has the advantage of a more favorable worst-case O(n log n) runtime. Heapsort is an in-place algorithm, but is not a stable sort.][6]