Time complexity compared
easy 18 minThe seven common time complexities in one place: 1 < log n < n < n log n < n² < 2ⁿ < n!.
Where it shows up
The same pattern appears across everyday software.
Database query planners
Before running a query, the database estimates the cost of each plan: an index lookup is O(log n), a full table scan O(n), a nested-loop join O(n · m) and a hash join O(n + m). Picking the plan with the best growth is what keeps queries fast as tables grow.
Sorting in standard libraries
Python's sorted and Java's object sort use Timsort, which is O(n log n) in the worst case but switches to insertion sort, an O(n²) method, on short runs because its small constants win at that size.
Delivery route planning
Checking every order of 20 stops means about 2.4 × 10¹⁸ routes, which is O(n!) and out of reach. Logistics software uses dynamic programming for small cases and heuristics such as nearest neighbour plus local improvements for real fleets.
Encryption strength
Security is built on exponential growth. Guessing a 128-bit key by brute force takes up to 2¹²⁸ tries, about 3.4 × 10³⁸, so even every computer on Earth together could not finish.
Features that break at scale
An O(n²) step, such as comparing every user with every other user, is instant with 1,000 users (a million comparisons) and hopeless with 1,000,000 (a trillion). Growth rates are why a feature can pass every test and still fail in production.
Programming contest time limits
Online judges give about 1 to 2 seconds per test. Contestants read the limit on n, apply the 10⁸ rule and know before coding whether O(n²) will pass or they need O(n log n).