Big-O Time Complexity Calculator

Operations vs. n for common Big-O classes: O(1), O(log n), O(n), O(n log n), O(n²), O(2ⁿ).

Inputs

Modern CPU: ~1e9 simple ops/sec.

Result

Loading calculator…

How to use this calculator

  • Enter input size n.
  • Pick complexity class.
  • Read estimated operations + wall-clock time.

About this calculator

Big-O notation describes algorithm growth rate as input size increases. O(1) — constant (hash lookup). O(log n) — binary search. O(n) — linear scan. O(n log n) — quicksort/mergesort, optimal comparison sort. O(n²) — bubble/selection sort, naive nested loop. O(2ⁿ) — naive recursive Fibonacci, brute-force subset. O(n!) — TSP brute force, factors quickly become impossible. Modern CPUs do ~10⁹ simple ops/sec; an O(n²) algorithm hits a wall at n ≈ 100,000.

Frequently asked

Why log base 2?+
For binary algorithms (search, divide-and-conquer). Other bases differ by constant factor — Big-O ignores constants.
Big-O hides constants?+
Yes. O(100n) and O(n) are the same Big-O. For practical performance, constants matter — measure, don't just analyze.
Best vs. worst case?+
Quicksort: avg O(n log n), worst O(n²). Big-O usually refers to worst-case unless qualified.
When does O(2ⁿ) become impossible?+
Around n = 40, 2^40 ≈ 10^12 — minutes at 1 GHz. n = 50: hours. n = 60: years. Practical limit ~30-40.
Is O(n!) ever practical?+
Up to n ≈ 12 (4 × 10^8 ops). Beyond that, need clever algorithms (DP, branch-and-bound) or accept approximate solutions.

Related calculators

More tools you might like

Hand-picked tools that pair well with this one — same audience, same intent.