|
Insertion |
Selection |
Bubble |
Shell |
Merge |
Heap |
Quick |
Quick3 |
|---|---|---|---|---|---|---|---|---|
Random |
|
|
|
|
|
|
|
|
Nearly Sorted |
|
|
|
|
|
|
|
|
Reversed |
|
|
|
|
|
|
|
|
Few Unique |
|
|
|
|
|
|
|
|
These pages show 8 different sorting algorithms on 4 different initial conditions. These visualizations are intended to:
The ideal sorting algorithm would have the following properties:
There is no algorithm that has all of these properties, and so the choice of sorting algorithm depends on the application.
Sorting is a vast topic; this site explores the topic of in-memory generic algorithms for arrays. External sorting, radix sorting, string sorting, and linked list sorting—all wonderful and interesting topics—are deliberately omitted to limit the scope of discussion.
above to restart
the animations in a row, a column, or the entire table.
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.
Comments
— posted by someone on 27-Jan-2010
— posted by someone on 13-Jan-2010
— posted by someone on 20-Dec-2009
— posted by someone on 8-Dec-2009