Algorithm | Wort case | Avg case | Best Case | Stable | In-place? |
Bubble sort | O(n2) | O(n2) | O(n2) | Stable | Yes |
Selection sort | O(n2) | O(n2) | O(n2) | Not Stable | Yes |
Insertion sort | O(n2) | O(n2) | O(n) | Stable | Yes |
Merge sort | O(n log n) | Stable | No. Need auxiliary space | ||
Quick sort | O(n2) | O(n log n) | Not stable | Yes | |
Heap sort | O(n log n) | O(n log n) | Not stable | Yes |
Leave a Reply