Name | Best-case | Average-case | Worst-case | Memory | Stable |
---|---|---|---|---|---|
Bogosort | n | (n × n!) | ∞ | 1 | no |
Bubblesort | n | n2 | n2 | 1 | yes |
Bucketsort | - | n + r | n + r | n + r | yes |
Cocktailsort | n | n2 | n2 | 1 | yes |
Combsort | n | n log n | n2 | 1 | no |
Cyclesort | - | n2 | n2 | 1 | no |
Gnomesort | n | n2 | n2 | 1 | yes |
Heapsort | n log n | n log n | n log n | 1 | no |
Insertionsort | n | n2 | n2 | 1 | yes |
Mergesort | n log n | n log n | n log n | worst: n | yes |
Odd-even sort | n | n2 | n2 | 1 | yes |
Quicksort | n log n | n log n | n2 | average: log n worst: n |
no |
Radixsort (LSD) | - | n × (k/d) | n × (k/d) | n | yes |
Selectionsort | n2 | n2 | n2 | 1 | no |
Shellsort | n log n | n log2 n | n2 | 1 | no |
Stoogesort | n2.71 | n2.71 | n2.71 | 1 | no |
Note:
n: items/records/keys to be sorted.
k: key size.
d: digit size.
r: range of numbers.