Recursion in C++
The principles of recursion are the same, regardless of the language used for implementation. This chapter views the topic through the lens of C++. There are a fair number of examples and visualizations. Read through these at a minimum. You might find the exercises useful since the application of a principle is an aid to your understanding. Read Chapter 5 in this book on C++.
1. Objectives
The goals for this chapter are as follows:
-
To understand that complex problems that may otherwise be difficult to solve may have a simple recursive solution.
-
To learn how to formulate programs recursively.
-
To understand and apply the three laws of recursion.
-
To understand recursion as a form of iteration.
-
To implement the recursive formulation of a problem.
-
To understand how recursion is implemented by a computer system.
Source: Runestone Academy, https://runestone.academy/runestone/books/published/cppds/Recursion/toctree.html
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 License.