📊 Sorting Visualizer

Watch six classic sorting algorithms work on the same arrayyellow = comparing, red = writing/swapping, green = in final position. The operation counts are real: this is why O(n²) and O(n log n) aren't just letters.

★ Star on GitHub
algorithm
Bubble
comparisons
0
array writes
0
array size
55
algorithmbestaverageworstspacestable
Try this: sort with Bubble at size 100 and read the comparison count, then do the same with Merge or Quick — the O(n log n) algorithms do a fraction of the work, and you can see the difference in how long the animation runs. Watch Insertion fly through a nearly-sorted array (its best case is O(n)), and watch Quicksort partition around a pivot then recurse into each half. Selection always does the same ~n²/2 comparisons no matter the input — its best and worst are identical.