Problem Solving

Recursive Case

Children remove a smaller box from a larger one.

Recursive Case definition

A recursive case is a branch of a recursive definition or procedure that uses the same rule on another input.

In Spanish
caso recursivo
Topic
Algorithms and problem-solving

Recursive Case in a picture

Recursive Case diagramThe factorial step for n > 0 multiplies n by the factorial of n − 1.If n = 0, return 1This is the base caseFor n > 0, evaluate (n − 1)!This is the recursive callReturn n × (n − 1)!Combine it to compute n!
The factorial step for n > 0 multiplies n by the factorial of n − 1.

How it works

When the input is outside the base cases, a recursive case reduces it to one or more simpler inputs. It describes how the returned values form the current result. The inputs must move toward a condition that the procedure can handle directly.

Worked examples

Which part of F(n) = n + F(n − 1) is recursive?

The call to F(n − 1).

For n = 4 in the factorial example, what smaller input is used?

3.

Can a recursive case use two smaller calls?

Yes, a recurrence can use more than one earlier result.

Common mistake

A recursive case must bring the procedure closer to a base case. Calling the same input again can make it loop indefinitely.

Quick check

What distinguishes a recursive case from a base case?

What should happen to input size?

Show answer

It should progress toward a base case.

Can a procedure have multiple recursive cases?

Show answer

Yes.

Sources

Flashcard

Recursive Case

Reveal the definition

A recursive case is a branch of a recursive definition or procedure that uses the same rule on another input.

Effortless Math. “Recursive Case.” Math Dictionary.