Big O Complexity Calculator

Compare how algorithm complexity classes scale with input size.

Please note: Provided for learning and for checking your own working. Institutions differ in the conventions and rounding they apply, so confirm the method against your own course materials.

What the Big O Complexity Calculator does

Big O notation describes how an algorithm’s work grows with input size, ignoring constant factors. That makes it the right tool for predicting whether something will still work when the data gets ten times bigger — which is usually the question that matters.

Formula

  • O(1) constant; O(log n) logarithmic; O(n) linear
  • O(n log n) linearithmic — the bound for comparison sorting
  • O(n²) quadratic; O(2ⁿ) exponential; O(n!) factorial
  • Runtime ≈ Operations ÷ Operations per second

Inputs explained

InputUnitRequiredNotes
Input size (n)textYesScientific notation works, such as 1e6.
Complexity classone of 9 optionsYes
Operations per secondtextYesA modern CPU core manages roughly 10⁹ simple operations a second.

How to use it

  1. Choose Complexity class.
  2. Enter Input size (n) and Operations per second.
  3. Select Calculate.

Worked example

An O(n log n) algorithm on a million items at 10⁹ operations a second.

n
1,000,000
Complexity
O(n log n)
Rate
10⁹/sec

log₂(10⁶) ≈ 19.93, so about 19.9 million operations — roughly 0.02 seconds. The same input under O(n²) would need 10¹² operations, about 17 minutes.

Frequently asked questions

Is a lower complexity class always faster?

Not at small inputs. Constant factors matter, which is why insertion sort beats quicksort on tiny arrays and real implementations switch between them.

Why is O(n log n) considered the sorting limit?

Any comparison-based sort must distinguish n! orderings, and log₂(n!) is Θ(n log n). Beating it requires assumptions about the data, as radix and counting sorts do.

Related calculators