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(n^{2})
elementary sorting algorithms (insert, selection, bubble) and
the more advanced algorithms.

- Click on above to restart the animations in a row, a column, or the entire table.
- Click directly on an animation image to start or restart it.
- Click on a problem size number to reset all animations.

- Black values are sorted.
- Gray values are unsorted.
- A red triangle marks the algorithm position.
- Dark gray values denote the current interval (shell, merge, quick).
- A pair of red triangles marks the left and right pointers (quick).

*Algorithms in Java, Parts 1-4, 3rd edition*
by Robert Sedgewick.
Addison Wesley, 2003.

*Programming Pearls*
by Jon Bentley.
Addison Wesley, 1986.

*Quicksort is Optimal*
by Robert Sedgewick
and Jon Bentley,
Knuthfest, Stanford University, January, 2002.

Dual Pivot Quicksort: Code and Discussion.

*Bubble-sort with Hungarian ("Csángó") folk dance * YouTube video, created at Sapientia University, Tirgu Mures (Marosvásárhely), Romania.

*Select-sort with Gypsy folk dance * YouTube video, created at Sapientia University, Tirgu Mures (Marosvásárhely), Romania.

Sorting Out Sorting, Ronald M. Baecker with the assistance of David Sherman, 30 minute color sound film, Dynamic Graphics Project, University of Toronto, 1981. Excerpted and reprinted in SIGGRAPH Video Review 7, 1983. Distributed by Morgan Kaufmann, Publishers. Excerpt.