← Back to Issue 3
← Back to Issue 4
All Labs
Sorting Algorithm Arena
Race 4 algorithms. See why O(n log n) crushes O(n^2).
Interactive companion to Issues 3 & 4
Race!
Pause
Step
Reset
Speed:
10x
Size:
30
Order:
Random
Nearly Sorted
Reversed
Few Unique
Sound Off
Bubble
Selection
Merge
Quick
×
Algorithm
Play
Reset
Bubble Sort
O(n^2)
Comparisons: 0 | Swaps: 0
Ready
Selection Sort
O(n^2)
Comparisons: 0 | Swaps: 0
Ready
Merge Sort
O(n log n)
Comparisons: 0 | Swaps: 0
Ready
Quick Sort
O(n log n) avg
Comparisons: 0 | Swaps: 0
Ready
Algorithm
Comparisons
Swaps
Status
Bubble Sort
0
0
Ready
Selection Sort
0
0
Ready
Merge Sort
0
0
Ready
Quick Sort
0
0
Ready
How They Compare
O(n^2)
O(n log n)
Try 100 elements!