This page presents a comparison of a variety of sorts.

The code is available here, in case you want to scrutinize how these results were produced.

As you can likely see in the graph:

- Most of the sorts are in a group - these are O(nlogn) sorts, EG mergesort.
- Bubble sort and Insertion sort veer into high runtimes quickly, because they are O(n^2).
- Radix Sort is in the pack with the (other) n*log(n) sorts. Granted, I've increased the magnitude of the numbers to sort as the arrays (lists) grew, but that's often what'll happen in real life.
- Shellsort's runtime complexity is not yet fully understood, but you can see it slowly moving into higher durations.

Graph type | Format 1 (scaleable) | Format 2 (bitmap) |

log-log | postscript | PNG |

linear-linear | postscript | PNG |

5522

Back to Dan's tech tidbits

You can e-mail the author with questions or comments: