排序算法的时间复杂度
Sorting Algorithms and Complexities
- n is the number of elements
- k is the number of distinct objects
| Algorithm | Time Complexity | Space Complexity | 
| Bubble sort |  |  - in place,  extra space. | 
| Insertion sort |  |  - in place,  extra space. | 
| Selection sort |  |  - in place,  extra space. | 
| Merge sort |  |  -  extra space. | 
| Heap sort |  |  - in place,  extra space. | 
| Quicksort |  -  expected, andwith high probability. |  inplace. | 
| Introsort |  |  -  extra space. | 
| Counting sort |  |  | 
| Timsort |  Best case  Worst Case |  | 
文章出处:http://www.algorithmist.com/index.php/Sorting
 
                    
                     
                    
                 
                    
                 
                
            
         
 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号