Chapter 2 · Simulation

Asymptotic Growth Explorer

← Chapter 2

Values for n = 1000 (log scale up to n³)

fgothersdashed = off scale

Crossover

Asymptotic Growth Explorer

Compare common growth rates at the same input size and see when one function overtakes another.

How to use

  • Enter an input size n (between 2 and 1,000,000) and press Compare.
  • The left panel shows the values of log₂ n, n, n log₂ n, n², n³ and 2ⁿ at that n. Bar lengths use a logarithmic scale whose right end is n³. If 2ⁿ is larger than n³, its bar is cut off and drawn dashed (off scale); otherwise all the other bars would shrink to almost nothing.
  • Pick two functions: f and g. The right panel shows the first integer with f(n) > g(n) (scanned from 2 to 100,000) and the values of both functions at your n.
  • Values beyond the floating-point range (2ⁿ for n > 1023) are shown as ∞.

Why it matters

Asymptotic notation compares long-run growth, not a single measured input size. A function with a higher growth rate can still be smaller for small n; the crossover point shows where the long-run ordering starts to hold. Constant factors shift the crossover point but never change which function is eventually larger.

Typical ordering

For large enough n, log n ≪ n ≪ n log n ≪ n² ≪ n³ ≪ 2ⁿ.