Sorting Algorithms Demo


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
Click on each graph to see the algorithm run or you may together.

You may also generate a new set of data, which is either the or for each 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.