DevPrep
  • Interview Prep
  • Projects
  • Resources
  • Pricing
  • About Us
Submit Question
DevPrep
  • Pricing
  • About Us
Submit Question
  1. Home
  2. Tools
  3. Big O Calculator

Big O Calculator

Enter an input size to see how different time complexities scale. Compare operation counts and estimated runtimes across all major Big O classes.

Languages
ConstantO(1)
Operations1
Est. Runtime
C/C++1 ns
Rust1 ns
Go2 ns
Java3 ns
JavaScript5 ns
Python40 ns
LogarithmicO(log n)
Operations9.97
Est. Runtime
C/C++10 ns
Rust11 ns
Go20 ns
Java30 ns
JavaScript50 ns
Python399 ns
LinearO(n)
Operations1.0K
Est. Runtime
C/C++1.0 us
Rust1.1 us
Go2.0 us
Java3.0 us
JavaScript5.0 us
Python40.0 us
LinearithmicO(n log n)
Operations10.0K
Est. Runtime
C/C++10.0 us
Rust11.0 us
Go19.9 us
Java29.9 us
JavaScript49.8 us
Python398.6 us
QuadraticO(n²)
Operations1.0M
Est. Runtime
C/C++1.0 ms
Rust1.1 ms
Go2.0 ms
Java3.0 ms
JavaScript5.0 ms
Python40.0 ms
CubicO(n³)
Operations1.0B
Est. Runtime
C/C++1.00 s
Rust1.10 s
Go2.00 s
Java3.00 s
JavaScript5.00 s
Python40.00 s
ExponentialO(2ⁿ)
OperationsOverflow
Est. Runtime
C/C++Heat death of universe
RustHeat death of universe
GoHeat death of universe
JavaHeat death of universe
JavaScriptHeat death of universe
PythonHeat death of universe
FactorialO(n!)
OperationsOverflow
Est. Runtime
C/C++Heat death of universe
RustHeat death of universe
GoHeat death of universe
JavaHeat death of universe
JavaScriptHeat death of universe
PythonHeat death of universe
Runtime estimates are approximate — click for methodology & sources

Multipliers are relative to C++ (~1 ns/op baseline): Rust ~1.1x, Go ~2x, Swift ~2.5x, Java ~3x, Kotlin ~3.2x, C# ~3.5x, JS/TS ~5x, PHP ~15x, Ruby ~30x, Python ~40x.

Sources:

  • Computer Language Benchmarks Game (benchmarksgame-team.pages.debian.net) — canonical cross-language compute benchmarks
  • TechEmpower Framework Benchmarks (techempower.com/benchmarks) — real-world web framework performance
  • “Energy Efficiency across Programming Languages” (Pereira et al., SLE 2017) — academic study comparing 27 languages

These are conservative medians from compute-bound workloads (sorting, matrix ops, fibonacci). Real performance varies significantly by workload type, compiler flags, JIT warmup, GC tuning, and hardware.

How to Use This Tool
  1. Step 1Enter Input Size

    Type a number or click a preset (10, 100, 1K, 10K, 100K, 1M) to set the input size n.

  2. Step 2Compare Complexities

    See 8 complexity classes side by side — from O(1) constant to O(n!) factorial — with exact operation counts.

  3. Step 3Read Estimated Runtimes

    Each card shows estimated wall-clock time assuming ~1 ns per operation. Compare across JavaScript, C++, and Python.

  4. Step 4Use for Interview Prep

    Practice identifying which complexity class your algorithm falls into. Compare to see why O(n²) breaks at scale.

Pro Tips
  • •For interview prep, try n = 10,000 — most O(n²) algorithms start to feel slow here.
  • •Exponential O(2ⁿ) becomes infeasible beyond n ≈ 25. Factorial O(n!) beyond n ≈ 12.
  • •Real-world algorithms are faster due to caching, SIMD, and compiler optimizations — these estimates are worst-case upper bounds.

What is Big O Notation?

Big O notation describes the upper bound of an algorithm's time or space complexity as the input size grows. It helps developers compare algorithms and predict performance at scale.

Common complexity classes from fastest to slowest: O(1) constant, O(log n) logarithmic, O(n) linear, O(n log n) linearithmic, O(n²) quadratic, O(2ⁿ) exponential, O(n!) factorial.

Understanding Big O is essential for technical interviews at companies like Google, Meta, Amazon, and Microsoft. This calculator helps you visualize how input size affects algorithm performance.

Practice

  • JavaScript
  • DSA
  • Machine Coding
  • System Design

Resources

  • Learning Tracks
  • Articles
  • Roadmaps
  • Compare Concepts
  • Glossary
  • Developer Tools
  • All Questions

Company

  • About
  • Pricing

Legal

  • Privacy Policy
  • Terms of Service
DevPrep

© 2026 DevPrep. All rights reserved.