Watch Encyclopedia

How Computers Sort

Putting things in order is one of the most common jobs a computer does. Some methods are far smarter than others.

What you are seeing

Each bar is a number. Red shows two bars being moved, and white shows two being compared.

Watch the counters. With 200 bars, the simple methods need many thousands of comparisons. The clever ones need a small fraction of that.

Try this

  • Run Bubble, then Quick, on 100 bars each.
  • Push the bars to 200 and compare Insertion with Merge.
  • Slow it right down and follow one bar.

Numbers

Merge sort invented
1945
Quick sort invented
1959

Keep watching

More to explore