The following graphically represent the progress of several common sorting algorithms while sorting an array of data (using constant space algorithms). Lines (each of different lengths) represent different values (longer lines for larger values).

Selection Sort | Bubble Sort | Insertion Sort | |
---|---|---|---|

Merge Sort | Heap Sort | Quick Sort | |

It is interesting to see what each algorithm does with already-sorted data too.

Code by James Gosling, Jason Harrison and Robert I. Pitts.