Time complexity · Space complexity · Algorithm efficiency · Section 4.4
| Notation | Name | Example |
|---|---|---|
| O(1) | Constant | Array access by index |
| O(log n) | Logarithmic | Binary search |
| O(n) | Linear | Linear search, traversal |
| O(n log n) | Log-linear | Merge sort, Quick sort (avg) |
| O(n²) | Quadratic | Bubble sort, Insertion sort |
| O(2ⁿ) | Exponential | Brute-force TSP, subsets |
| O(n!) | Factorial | All permutations |
| n | O(n²) | O(2ⁿ) |
|---|---|---|
| 10 | 100 | 1,024 |
| 20 | 400 | 1,048,576 |
| 50 | 2,500 | 1.1 × 10¹⁵ |
| 100 | 10,000 | 1.3 × 10³⁰ |