Iteration versus Recursion in the Fibonacci Sequence
The Fibonacci sequence is defined by , .[more]
To calculate , say, you can start at the bottom with , then , and so on. This is the iterative method.
Alternatively, you can start at the top with , working down to reach and . This is the recursive method.
The graphs compare the time and space (memory) complexity of the two methods and the trees show which elements are calculated.[less]
Snapshot 1: iterative and recursive tree plots for
Snapshot 2: same for
Snapshot 3: same for
 T. Cormen et al., Introduction to Algorithms, 3rd ed., Cambridge: The MIT Press, 2009.
 E. Lantzman, "Iterative vs. Recursive Approaches." Code Project (blog). (Jun 14, 2016) www.codeproject.com/Articles/21194/Iterative-vs-Recursive-Approaches.