← Back to all activities한국어 →
🏁 Sorting Algorithm Race

What happens when you line up the same bars
using different methods?

There is more than one way to sort jumbled bar heights from smallest to largest. Watch Bubble Sort, Selection Sort, and Quick Sort race to sort the same data, and see why their comparison counts differ so much.

Bubble Sort repeatedly compares neighboring bars and pushes the larger one backward (it is the slowest). Selection Sort finds the smallest one each time and moves it forward. Quick Sort chooses a pivot and repeatedly divides the data into smaller and larger groups (it is usually the fastest).
🫧 Bubble Sort
Comparisons 0
🎯 Selection Sort
Comparisons 0
⚡ Quick Sort
Comparisons 0
Number of bars30
SpeedNormal
Click "Start race"
💡 Increase the number of bars. When the number of bars doubles, Bubble Sort and Selection Sort need nearly four times as many comparisons (N²), while Quick Sort grows much more slowly (N log N) — this is the real difference in sorting algorithm "speed."