9 min read Intermediate Lesson 3 of 7
Part 1 — Foundations

Recursion & Call Stacks

Recursion is solving a problem by defining it in terms of smaller instances of itself. Understanding how recursion winds and unwinds the CPU stack frame is essential for trees, graphs, and dynamic programming.

The 2 Non-Negotiable Rules

1. Base Case (Terminal Condition)

A terminating branch that returns a concrete answer directly without further recursive calls.

2. Recursive Step Towards Base

Every step MUST reduce the problem size closer towards the base case (e.g. $n - 1$ or $n / 2$).

Quick Summary

  • Every recursive function requires a base case to prevent stack overflow crashes.
  • Next, we explore Divide & Conquer.