Real World Maths Busters
The Maths Behind Everyday Life
The story, the formula and a worked example — see exactly where this maths shows up in the world around you.
Technology 3 min read
Why Sorting a Million Items Takes Only 20 Million Steps
Efficient sorting is O(n log n), not O(n²).
Bubble sort checks every pair: for 1 million items that’s a trillion comparisons. But merge sort splits and conquers, needing only n × log₂(n) steps.
The n log n Advantage
For n = 1,000,000: n² = 10¹². But n × log₂(n) = 1,000,000 × 20 = 20,000,000. That’s 50,000× fewer steps.
Sorting 1 million items
- 1
Naive (n²)
- 2
Efficient (n log n)
- 3
Speedup
Answer
50,000× faster with the right algorithm
The takeaway
Algorithm choice matters more than hardware. n log n vs n² is the difference between seconds and days.