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:

  1. Most of the sorts are in a group - these are O(nlogn) sorts, EG mergesort.
  2. Bubble sort and Insertion sort veer into high runtimes quickly, because they are O(n^2).
  3. 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.
  4. Shellsort's runtime complexity is not yet fully understood, but you can see it slowly moving into higher durations.

  • Here is the graph.

    Hits: 13551
    Timestamp: 2024-04-20 13:39:42 PDT

    Back to Dan's tech tidbits

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