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 03 · DSA · Worked, and deeper · about 22 min to read

Play it as a journeyTutor comes with a plan

DP, five more shapes

The DP Table
The DP Table · Open board

Shows two grids filled by hand, each cell built from cells already filled, the answer waiting in a corner. This lesson keeps that rule and changes what a single cell means.

Before you start. Recursion & Dynamic Programming gave you the trick: answer each small copy of a question once, write it in a notebook, and build bigger answers from notebook entries instead of solving them again. That notebook can be one row (the ways to reach step n are the ways to reach n-1 plus the ways to reach n-2), and Dynamic Programming, Worked (filling the table) filled it as two grids, knapsack and LCS, where a subsequence means items kept in their order with gaps allowed.

Lesson 18 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

  • 1962: a salesman, thirteen towns, and a notebook with no obvious pages
  • The state: the heading on each notebook page
  • Longest increasing subsequence: a state that must end at me
  • Interval DP: choose the balloon that bursts last
  • Bitmask DP: the salesman’s visited set, as one number
  • DP on a tree: each house hands up two numbers
  • State machine DP: what you are doing today
  • How to spot which shape you are in
  • The ladder, per shape

Terms it explains: state, recurrence, ends exactly at, last, interval, bitmask, state machine.

Lab

The same recursion runs three ways. Which one solves ways(3) fifty-five times, and which solves it once?

Stay on Ask again every time, press Show next step twenty times, and watch calls made in The bill so far.

Open The DP table

Review DSA