Sorting algorithms
100 numbers, 6 algorithms. Watch them sort together.
Elements Active CompletePlayed 0.0 s · same input
Bubble sort
Bubble sortOperations0
Comparisons0
Writes0
Selection sort
Selection sortOperations0
Comparisons0
Writes0
Insertion sort
Insertion sortOperations0
Comparisons0
Writes0
Merge sort
Merge sortOperations0
Comparisons0
Writes0
Quick sort
Quick sortOperations0
Comparisons0
Writes0
Heap sort
Heap sortOperations0
Comparisons0
Writes0
Each comparison or write counts as 1 operation. Playback time is not execution time.
How it works +
All algorithms use the same integers, with 20, 50, 100 or 200 elements. Each comparison or main-array write counts as 1 operation; a swap usually needs 2 writes. Temporary storage and loop control are excluded.
Operation counts illustrate the algorithms; playback time is not execution time. Yellow marks active elements and green marks completion.