What information entered the process?
Labs / Computer Science
Sorting Algorithms
Forty bars, four classic ways to sort them. The highlighted pair is the one move the algorithm is making right now — press Play to let it run, or tap the canvas to step through by hand. Every algorithm gets the same shuffled deck until you reshuffle, so the compare and swap counters are a fair race.
Labs / Computer Science / Sorting Algorithms
Sorting Algorithms
Forty bars, four classic ways to sort them. The highlighted pair is the one move the algorithm is making right now — press Play to let it run, or tap the canvas to step through by hand. Every algorithm gets the same shuffled deck until you reshuffle, so the compare and swap counters are a fair race.
Why it matters
Why explore this?
Computer science turns clear rules into reliable processes. This model lets you step through those rules and see how each decision changes the result.
Explore
Try the model
Investigate
Questions to test
Predict first, try it in the model, then use what you observe to answer.
What to try
- Run Bubble to the end and note the counters. Now run Quick on the same deck. How big is the gap?
- Step through Insertion by hand for ten moves. Can you predict each next move before it happens?
- Selection makes very few swaps but never fewer comparisons. Watch it — why is that?
- Shuffle until you get a deck that is almost sorted already. Which algorithm benefits the most?
Explain
Make sense of what happened
Trace the process one step at a time. Name the rule used at each important step, then explain why the final result follows from those rules.
Check
Before you leave
Which rule changed it?
Why did the process produce this result?
If you can answer all three using evidence from the model, you understand the main idea. If not, return to Explore and change one setting at a time.