base case

The smallest input a recursive function answers directly, without calling itself again, which stops the recursion.

In more detail

For a factorial function the base case is n equal to zero or one. In dynamic programming tables, base cases are the first row and column filled before anything else. A missing or unreachable base case causes infinite recursion and, in Python, a RecursionError.

Related terms

Taught in

References

Certification courses