Big O Complexity Comparator
Compare the growth rates of common Big O complexity functions for a given input size n. See how many operations each complexity class requires.
Results will appear here.
Formulas
For input size n and logarithm base b:
- O(1) = 1 (constant)
- O(log n) = logb(n) = ln(n) / ln(b)
- O(√n) = n0.5
- O(n) = n
- O(n log n) = n × logb(n)
- O(n²) = n2
- O(n³) = n3
- O(2n) = 2n
- O(n!) = n × (n−1) × … × 2 × 1 (exact up to n ≤ 170; ∞ beyond)
Assumptions & References
- Operations counts are theoretical and represent the dominant term only — constants and lower-order terms are ignored per Big O convention.
- The logarithm base does not change the Big O class (only a constant factor), but it does affect the raw operation count shown here.
- O(n!) overflows IEEE 754 double precision for n > 170 and is shown as ∞.
- O(2n) becomes astronomically large for n > ~60 and is shown in scientific notation.
- Reference: Cormen, T. H. et al. Introduction to Algorithms, 4th ed. MIT Press, 2022.
- Reference: Knuth, D. E. The Art of Computer Programming, Vol. 1. Addison-Wesley, 1997.
- Big O notation describes an upper bound on growth rate in the worst case.