← Course overview

Computer science foundations · 10 minutes

Recursion and stopping

Explain recursion with a small factorial example. Identify the base case, the recursive step and why the process terminates.

Study · reference notes

Describe a recursive call

A recursive function calls itself, directly or indirectly, to solve a related subproblem. Each call has its own execution context.

Identify a base case

A base case returns an answer without another recursive call. For nonnegative integer factorial, factorial(0) = 1 is a base case.

Show progress to stopping

For n greater than zero, factorial(n) = n times factorial(n - 1). Decreasing a nonnegative integer toward zero ensures the recursion reaches its base case.

Read the primary teaching material: MIT OpenCourseWare: recursion ↗

Independent lesson notes · independent tutor review pending

Checking your account…

Sign in to save drafts, receive feedback and schedule reviews. Tutors see only work you submit to their assignments.

Sign in to practice