Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 02 · DSA · Choosing the attack · about 18 min to read

Play it as a journeyTutor comes with a plan

Recursion & Dynamic Programming

Recursion and Dynamic Programming
Recursion and Dynamic Programming · Open board

The same small puzzle drawn again inside itself, smaller each time, with a note pinned to the copies someone has already solved.

Before you start. You need to know what happens when one function calls another: it pauses, hands control over, and picks back up exactly where it left off when the called one returns,How Code Becomes Execution (compilers, stack & heap) is where that pause-and-resume machinery lives. Here the function calls itself instead of a different one, which is the only new part.

Lesson 11 of 96 in DSA

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1950: a mathematician needs a word nobody will cut
  • The trick: answer the smallest copy first
  • A function that calls itself, and the base case that stops it
  • The tree that repeats itself
  • The notebook that turns fifteen calls into nine

Terms it explains: recursion, base case, hit, miss, memoization, optimal substructure, overlapping subproblems, O(2ⁿ), O(n), φ = 1.618, mutable default argument, state, recurrence, base cases, order, space, 1-D, 2-D / grid, greedy, dynamic programming, knapsack / edit distance / LCS, recursion tree, rolling array, tabulation, time, Viterbi.

Review DSA