Big-O explorer
Big-O describes how the work a piece of code does grows as its input grows. Play with the curves, keep the cheat sheets handy, then measure your own function and see which curve it follows.
How fast do things grow?
Drag n to zoom the chart. Hover, touch, or use the arrow keys on the chart to read every curve at one point.
| Class | Operations | Time at 1 billion ops/s | In plain English |
|---|
Cheat sheets
Quick reference for the things you will meet in interviews and exams.
Try your code
Paste a JavaScript function. It is run at growing input sizes inside a sandboxed Web Worker (never on this page) and timed. A 12 second limit stops runaway code.
Tab inserts 2 spaces. Press Esc then Tab to move focus out. Ctrl+Enter measures.
| n | Time per call |
|---|
Be honest with yourself: timings are noisy (other tabs, CPU speed changes, JIT warm-up, coarse browser timers), so the fitted class is a trend, not a proof. O(1) vs O(log n) and O(n) vs O(n log n) sit very close together. Always confirm by reading the code.
Quiz me
Six quick questions. What is the time complexity of each snippet?