Algorithms
Big-O Notation in 5 Minutes
How to read time/space complexity and why it matters.
On this page
Big-O Notation
Big-O describes the upper bound on how running time grows with input size n.
Common Orders
| Notation | Name | Example |
|---|---|---|
| O(1) | Constant | Array element access |
| O(log n) | Logarithmic | Binary search |
| O(n) | Linear | Array traversal |
| O(n log n) | Linearithmic | Merge sort |
| O(n²) | Quadratic | Nested loops |
Drop constants and lower-order terms:
O(2n + 5) = O(n).
