Interactive benchmark
Sorting Algorithm Race
Put all eight sorting algorithms on identical arrays and measure the truth: comparisons, data moves, and wall time. Change the size and data pattern, then press race to see the Big O theory turn into numbers.
Contenders (toggle to include or exclude)
Array size
200
random data
Fastest by time
-
wall-clock winner
Fewest comparisons
-
theoretical cost
Fewest data moves
-
memory writes
The replay
Bars advance in proportion to each sort's measured wall time. Finish order is real benchmark data, played back at a readable speed.
Comparisons
Key-to-key comparisons per sort. Big O puts these items in classes, the race puts them in order.
Data moves
Actual array writes. Selection Sort moves data the least, Merge Sort the most because of its temporary buffer.
Full results
Read the results like a pro
Wall time answers "which is fastest on this machine right now", comparisons and moves answer "which does the least work". Small sizes hide the difference, so bump the slider to 500 and watch the O(n^2) sorts curve away from the O(n log n) pack, exactly as the Big O chart predicted. Remember that a benchmark on random data never tells the whole story, switch to the nearly sorted and reversed patterns to see Insertion Sort soar and naive Quick Sort stumble.