• Unit 6: Recursion

    Often considered one of the more conceptually difficult concepts within the field of computer science, recursion – the act of a function invoking itself – is a powerful and relevant tool. In this unit, we will take an in-depth look at recursion, learning how to develop recursive processes, the role that recursion plays in common data structures, and what happens inside the computer when a function is invoked recursively. By the end of this unit, you will recognize situations that require recursion and be able to apply it appropriately.

    Recursion can be a difficult concept for students new to computer science. If you feel anxious, your best best is to use examples. In this unit, we will use recursion to write a program to express factorials (N!). This straightforward example will give you an overview of all the major components of recursion. Many good examples are also illustrated through the unit, particularly in the sections that discuss the Towers of Hanoi and the Merge Sort.

    Completing this unit should take you approximately 7 hours.

    • 6.1: What is Recursion?

    • 6.2: Recursive Structures

    • 6.3: Recursive Steps

    • 6.4: Applying Recursion

    • 6.5: Examples of Recursion

      These examples are in addition to the ones shown earlier in this unit.

        • 6.5.1: Examples in C/C++

        • 6.5.2: Examples in Java

      • Unit 6 Assessment

        • Receive a grade