BEGINNER · 8 MIN · FREE LESSON
Big-O notation
Count the work, not the clock.
Loading interactive lesson…
BEGINNER · 8 MIN · FREE LESSON
Count the work, not the clock.
Loading interactive lesson…
Count one read for each value in this single-pass sum.
This single-pass sum visits each element exactly once, so doubling n doubles its reads.
Measured reads + comparisons, seed 42. Plotted sample sizes respect each lesson’s explicit input limits.
Keyboard: Space play/pause · ←/→ step · R restart · 1–5 speed. Reduced motion disables transitions.
Like counting plates to wash, input size tells us how much work remains.
Use the player above to run, pause, scrub, or step backwards through a deterministic trace.
Switch to Try mode and predict each operation before revealing its result.
A single pass takes linear time. Use best, average and worst presets to compare measured counters. The chart plots actual reads and comparisons for n = 8, 16, 32 and 64.
Choose JavaScript, Python, Java or C++ in the synchronized code panel.
Summing a stream or scanning a list.
Big-O ignores constants; it does not predict exact milliseconds.
Complete the three questions below, then use the module navigation to choose your next lesson.
MAKE IT STICK
Progress saves on this device and merges with your account after sign-in.
0 / 5000 · Saved on this device; synced when signed in.