Recursion
Functions that call themselves: base cases, the call stack, recursion trees and when to turn recursion into a loop.
- Recursion: base case, recursive case, the call stack A recursive function solves a problem by calling itself on a smaller one until it reaches a base case. Watch frames push on each call and…
- Recursion trees: Fibonacci and repeated work Some recursive functions call themselves more than once, forming a tree of calls. Naive Fibonacci repeats the same subtrees again and again.