LOGBOOK

HELP

Quiz Entry - updated: 2026.09.18

Why does every recursive definition need a base case (Verankerung), and what happens without one?

The base case is the non-recursive branch that terminates the descent; without it the calls never stop and the program dies with a stack overflow.

An anchored recursion reaching its base case beside an unanchored one running past it

* The base case is what the chain of calls is fastened to; without it the descent never lands. *

$$f(n) = \begin{cases} 1 & \text{if } n = 0 \\ n \cdot f(n-1) & \text{else} \end{cases}$$

A recursive definition has exactly two obligations, and they are both about termination:

  1. A base case — at least one input handled without recursing. Here: $f(0) = 1$.
  2. Progress toward it — every recursive call must move strictly closer to that base case. Here: the argument drops from $n$ to $n-1$, so the descent from any $n \ge 0$ reaches 0 in finitely many steps.

Break either one and the recursion is infinite. Drop the base case and the calls run past 0 into negative numbers forever. Keep the base case but recurse on the wrong argument — return n * factorial(n) — and the descent never moves, which is the same disaster with a typo instead of an omission.

The failure mode is a stack overflow, not a hang: each pending call occupies a frame, the stack is finite, and it runs out after a few thousand levels. That is a useful thing to know when reading the error — a StackOverflowError almost always means a missing or unreachable base case.

Tip: the German term Verankerung ("anchoring") is a good mental image — the base case is what the chain of calls is anchored to, and an unanchored chain has nothing to pull it back.

Go deeper:

  • doc Stack overflow — what actually runs out, and why the depth limit lands where it does.

From Quiz: ADS / Asymptotic Analysis, O-Notation and Recursion | Updated: Sep 18, 2026