Bubble sort |
Θ(N) |
Θ(N2) |
Θ(N2) |
Θ(1) |
Yes |
|
Selection sort |
Θ(N2) |
Θ(N2) |
Θ(N2) |
Θ(1) |
No |
Stable with Θ(N) extra memory. |
Insertion sort |
Θ(N) |
Θ(N2) |
Θ(N2) |
Θ(1) |
Yes |
Θ(N) if almost sorted. |
Heapsort |
Θ(NlogN) |
Θ(NlogN) |
Θ(NlogN) |
Θ(1) |
No |
|
Merge sort |
Θ(NlogN) |
Θ(NlogN) |
Θ(NlogN) |
Θ(N) |
Yes |
Good cache performance |
Random Quicksort |
Θ(NlogN) |
Θ(NlogN) |
Θ(N2) |
Θ(logN) for the stack frames, Θ(1) otherwise |
No |
Fastest sort |