Trees, and why their shape decides everythingLesson 2 of 10Free preview

Recursion and the call stack

fact(5) makes 5 calls, stacks 5 frames and returns 120. The same stack is how a tree walk finds its way back up.