Recursion

Objective

  • Use recursion to implement algorithms

Recursion

    These topics are covered in detail in the text, so these notes won't bother reiterating them. The class session will discuss recursion in general and then illustrate recursion by implementing some recursive functions.

    • Recursion: when a function calls itself either directly or indirectly
    • recurse.cpp: demo of recursive functions
    • recursion.cpp: more complete demonstration of recursive functions
    • Fibonacci2.cpp: more generalized recursive Fibonacci program
    • RecursiveLargest.cpp: finds the largest array element recursively