Summary
In this chapter, we learned how to write iterative and recursive versions of two famous algorithms: the factorial of a number and the Fibonacci sequence. We learned that in case a recursive algorithm needs to compute the same result more than once, we can use an optimization technique called memoization.
We also compared the performance of the iterative and recursive versions of the Fibonacci algorithm, and we learned that even though the iterative version might be faster, a recursive algorithm is easier to read and understand what it is doing.Â
In the next chapter, we will learn the tree data structure and we will create the Tree
 class, where most of its methods use recursion.