All tools

Sorting Visualizer

Watch bubble, insertion, selection, quicksort run.

Step 1 / 1

Watch sorting algorithms work. Quicksort typically wins because it's O(n log n) on average. Bubble, insertion, and selection are all O(n²) but useful for small or nearly-sorted arrays.

About

Pick a size and an algorithm. Hit sort. Bars represent values; the algorithm steps through and the bars resolve. Helpful for seeing why O(n²) sorts slow down at larger sizes.

How to use

  1. Pick algorithm and size.
  2. Hit sort.

FAQ

Why is bubble sort so slow?+

Bubble does O(n²) compares. Quicksort does O(n log n) on average. The difference is dramatic at size 60+ - bubble takes thousands of steps where quicksort takes hundreds.