Base Case

noun

say it: “BAYS KAYS” /beɪs keɪs/

The part of a recursive function that answers at once, without calling the function again, so the calls stop.

What is a base case?

The base case is the smallest version of a problem, the one a recursive function answers without calling itself again: the solid doll at the middle of a set of nesting dolls, or the 0 that ends a countdown. Every call must move toward it, or the calls never stop.

In a sentence

  • “The base case of my countdown is 0: it prints Liftoff! and stops calling itself.”

Level: Apprentice · More Data Structures terms at this level

Updated