« Back to full matrix

Animated Sorting Algorithm Demo: Random Initial Order

Size: 20 · 30 · 40 · 50 ·
Initial Condition: Random · Nearly Sorted · Reversed · Few Unique Keys

Discussion

A random initial order is often used to evaluate sorting algorithms in order to elucidate the "typical" case and to facilitate mathematical analysis. For some applications, however, this does not represent the typical case, so conclusions drawn here do not generalize.

Here we see the vast difference in speed between the O(n2) elementary sorting algorithms (insert, selection, bubble) and the more advanced algorithms.

Directions

Key