Growth Rate Comparison
n = 10
| Complexity | Example Algorithm | n=1000 (est.) |
|---|---|---|
| O(1) | Array index lookup | ~1 ns |
| O(log n) | Binary search | ~10 ns |
| O(n) | Linear search | ~1 μs |
| O(n log n) | Merge sort | ~10 μs |
| O(n²) | Bubble sort | ~1 ms |
| O(2ⁿ) | Fibonacci (naïve) | ~10³⁰⁰ years |
Sorting Algorithm Race
Bubble Sort
Quick Sort
Merge Sort
Each bar = one element. Highlighted = currently comparing/swapping.