Putting things in order is one of the most common jobs a computer does. Some methods are far smarter than others.
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.
Keep watching
Computing
Draw a few cells, press run, and watch a tiny rule grow into moving machines.
Computing
Flip eight switches and see how ones and zeros become numbers, letters and shades.
Computing
Draw walls between two points and watch a computer hunt for the way through.