Sorting Visualiser — Bubble · Selection · Insertion · Merge · Heap · Radix
Type up to 10 numbers, choose a sorting algorithm, and press Play. Watch the bars compare (amber), move (red), and lock into place (green) step by step. The stats track exactly how many operations each algorithm needs — the best way to feel why some sorts are faster than others.
How to Play
Run the same 10 numbers through every algorithm and compare the Total ops. You'll see Bubble and Selection do the most comparisons, Insertion shine on nearly-sorted input, and Merge and Heap stay efficient. Radix does zero comparisons — it sorts purely by looking at digits.
How Much Effort Each Sort Uses
| Algorithm | Best | Average / Worst | Space | Stable | How it works |
|---|---|---|---|---|---|
| Bubble | O(n) | O(n²) | O(1) | Yes | Swap adjacent pairs; biggest bubbles up |
| Selection | O(n²) | O(n²) | O(1) | No | Pick the smallest, place it, repeat |
| Insertion | O(n) | O(n²) | O(1) | Yes | Insert each item into the sorted left part |
| Merge | O(n log n) | O(n log n) | O(n) | Yes | Split in half, sort, then merge |
| Heap | O(n log n) | O(n log n) | O(1) | No | Build a max-heap, pull the max repeatedly |
| Radix | O(d·n) | O(d·n) | O(n + k) | Yes | Sort by each digit, least significant first |
n = how many numbers, d = number of digits, k = digit range (10).
The O(n²) sorts (Bubble, Selection, Insertion) are simple but their operation count grows fast. Merge and Heap scale far better at O(n log n). Radix can beat them all when numbers have few digits, because it never compares values — it just buckets digits.