Step Counter Simulator

Teach the same idea without “math mode”: run a mini-debugger that counts loop iterations and recursive calls.

Tips: Enter step · Space auto · R reset
Learning goal Loops: count repetitions Recursion: count calls + work per call Big-O: dominant growth

This page shows a trace (what runs), a stack view (for recursion), and a line hit heatmap (which statements dominate).

Pick an example

Big-O: —
32

The simulator limits trace length for huge runs and uses sampling when needed.

Counters
Total steps
0
Calls / iterations
0
Trace status
What to say while teaching
  • Heatmap shows which line dominates.
  • Loops dominate by repetition (hits explode).
  • Recursion dominates by #calls × local work.
  • Base case stops recursion — that sets the depth.

Code view + line hits

line hit heatmap updates while stepping
Line-hit Heatmap (dominance)

The line with the highest hit count usually explains the Big-O.

Execution trace

latest events
Trace log
Call stack (recursion)
empty for loops