Recursion is when a function calls itself either directly or indirectly. We will look at some examples in class.
- recursion exists to make the programmer's life easier
- any recursive algorithm can be rewritten using repetition structures
- recursion usually uses many computer resources such as processing cycles and memory, so iterative alternatives may be preferable if time critical or memory intensive situations
- testfunc11.cpp: recursive and non-recursive factorial functions
- testfunc17.cpp: recursive and non-recursive GCD functions
- testfunc16.cpp: recursive Towers of Hanoi solver