| π(1) |
Constant |
Runtime does not change with input size. |
Accessing an array index, pushing/popping from a stack. |
| π(logπ) |
Logarithmic |
Runtime grows slowly; input size is halved each step. |
Binary Search. |
| π(\sqrt{π}) |
Square Root |
Efficiently narrows down search space for math-heavy tasks. |
Trial Division (Primality Test), Finding all divisors. |
| π(π) |
Linear |
Runtime grows proportionally to input size. |
Simple loop, linear search. |
| π(πlogπ) |
Linearithmic |
Slightly more than linear; common in efficient sorting. |
Merge Sort, Heap Sort. |
| π(n * m) |
Bi-Linear |
Time depends on two different input sizes. |
Comparing every item in List A to List B, Matrix Multiplication (Rectangular). |
| π(π^2) |
Quadratic |
Runtime grows with the square of the input. |
Nested loops, Bubble Sort, Insertion Sort. |
| π(π^3) |
Cubic |
Three nested loops. Becomes very slow quickly. |
Naive Matrix Multiplication, Triple nested loops. |
| π(c^π) |
Exponential |
Time grows by a constant base (2^n, 3^nβ¦). |
Recursive Fibonacci, power set generation. |
| π(π!) |
Factorial |
Growth is massive even for small π. |
Permutations of a string, Traveling Salesperson problem. |