Ordering of Common Complexity Classes
Complexity classes are ranked by how quickly their growth rate increases as input size n grows. Lower growth rates scale better for large inputs, even if they might be slower for very small n due to constant factors.
O(1) - Constant
O(log n) - Logarithmic
O(n) - Linear
O(n log n) - Linearithmic
O(n^2) - Quadratic
O(n^3) - Cubic
O(2^n) - Exponential
O(n!) - Factorial
In practice, for very small inputs an O(n^2) algorithm with low constant factors can outperform an O(n log n) algorithm with high constant factors, which is why algorithms like Insertion Sort are sometimes used as a base case in hybrid sorts like Timsort or Introsort.