Recursion trace · Java
222.
Count Complete Tree Nodes
Primary: value-combining
Secondary: structure traversal
Nodes labelled by heap index: children of #i are #2i and #2i+1
Input
Custom n (0–31)
Run it
Algorithm
Height shortcut
Naive walk
↻ Reset
◀ Back
▶ Play
Next ▶
Speed
READY
Press Next to make the first call.
Source
Call stack
newest on top
Recursion tree
one node per call, drawn in call order
active
on the stack
perfect → formula
null → 0
returned
not called yet
The tree being counted
frame's node
on the height probe
counted by 2
h
−1
counted by a call
never visited