Free · Interactive · No signup

Big-O Complexity Visualizer

“What’s the time complexity?” is asked in nearly every coding interview. Drag the input size and watch the seven common complexity classes pull apart — it makes why O(n²) is fine for 1,000 items but a disaster for a million obvious.

1,000

Bars are scaled logarithmically (each class spans many orders of magnitude). “Operations” is the approximate work done. Rule of thumb: ~108 operations ≈ 1 second.

Complexity comparison table

Approximate operation counts. Green scales comfortably; red is only viable for tiny inputs.

Complexityn = 10n = 100n = 1,000n = 1,000,000
O(1) constant1111
O(log n) logarithmic371020
O(n) linear101001,0001,000,000
O(n log n)336649,966~2×107
O(n²) quadratic10010,0001,000,0001012
O(2ⁿ) exponential1,024~1030~10301astronomical
O(n!) factorial~3.6M~10158astronomicalastronomical

Common operations → complexity

Array index / hash lookupO(1)
Binary search (sorted)O(log n)
Single loop / linear scanO(n)
Efficient sort (merge/heap/quick avg)O(n log n)
Nested loops over the same inputO(n²)
Generate all subsetsO(2ⁿ)
Generate all permutationsO(n!)

FAQ

What’s the order from fastest to slowest?

O(1) < O(log n) < O(n) < O(n log n) < O(n²) < O(2ⁿ) < O(n!). Everything up to O(n log n) scales well.

How large an input can each handle in ~1 second?

At ~108 ops/sec: O(n)/O(n log n) → 10M+, O(n²) → ~10,000, O(2ⁿ) → n≈26, O(n!) → n≈11.

Why is O(log n) so fast?

It halves the work each step. For a million items, log2 is only ~20 — binary search needs ~20 comparisons, not a million.

Is this free to share?

Yes — free, no signup, link it anywhere. Published by CoPilot Interview.

State your complexity with confidence

Interviewers expect you to analyze what you write — out loud, in real time. CoPilot Interview is a desktop AI assistant that surfaces the approach, the code, and the Big-O during live coding rounds, with a permanent free tier.

See how it works