Compare common algorithmic complexities at any input size. Pick an n, choose how many operations per second your machine handles, and see how each curve scales — and exactly when your code stops fitting in a single frame, request, or coffee break.
Operations vs. input size on a log–log plot. Steeper line = faster growth = bigger trouble at scale.
O(1) — Hash table lookup, array index, stack push.
O(log n) — Binary search, balanced BST find, heap insert/pop.
O(n) — Single pass: Array.map, linear search, sum reduce.
O(n log n) — Merge sort, quicksort (avg), FFT, comparison sort lower bound.
O(n²) — Nested loop, bubble/insertion sort, naive matrix-vector multiply.
O(n³) — Naive matrix multiplication, Floyd–Warshall shortest paths.
O(2ⁿ) — Brute-force subset enumeration, naive recursive Fibonacci, SAT solving.
O(n!) — Brute-force traveling salesman, generate all permutations.