Skip to main content
Engineering LibreTexts

2: Recursion

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)

    Unit Introduction

    This unit introduces the learner to the processes that repeat themselfs in a self-similar way. The processes can either call themselves directly or indirectly during their execution. The unit will enable the learner to understand the recursion process and solve problems that are recursive in nature.

    Unit Objectives

    Upon completion of this unit the learner should be able to:

    • develop algorithms for recursive programs
    • implement recursive formulation of a problem
    • explain recursion as a form of iteration

    Key Terms

    • Recursion: This is a process whereby a method calls itself so as to achieve repetitious
    • Base case: Is a boolean test at which the recursion ceases to “wind up” and starts to “unwind”.
    • Recursive step: Is a method call which causes the recursion to “repeat” on each successive iteration (unless the base case is reached).

    Learning Activities

    • 2.1: Activity 1 - Recursive Algorithm
      The learners are introduced to recursive processes and learn how a method calls itself in order to achieve repetitious behaviour. By using recursive algorithms, the learners will be in a position to solve problems of this nature.
    • 2.2: Unit Summary

    2: Recursion is shared under a CC BY-SA license and was authored, remixed, and/or curated by Harrison Njoroge.

    • Was this article helpful?