Note

A reminder of sorting algorithms. Credit for original animated images goes to Wikipedia.

Name Best Average Worst Memory Stable Method
Quicksort $n\log{n}$ $n\log{n}$ $n^{2}$ $\log{n}$ Depends Partitioning
Merge sort $n\log{n}$ $n\log{n}$ $n\log{n}$ Worst: $n$ Yes Merging
Heapsort $n\log{n}$ $n\log{n}$ $n\log{n}$ $1$ No Selection
Insertion sort $n$ $n^{2}$ $n^{2}$ $1$ Yes Insertion
Bubble sort $n$ $n^{2}$ $n^{2}$ $1$ Yes Exchanging

Index