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 17 min to read

Play it as a journeyTutor comes with a plan

Dynamic Programming, Worked (filling the table)

The DP Table
The DP Table · Open board

The companion to Recursion & Dynamic Programming: that lesson gave the idea in words, this one fills two real grids by hand until the answer sits in a corner for you.

Before you start. You need Recursion & Dynamic Programming‘s idea already: solve a small version of a question once, write the answer down, and build the bigger answer from answers already sitting there. That lesson gave you the words. This one runs it by hand, on two problems you’ll meet in an interview.

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

  • 1970: two protein chains, and no way to compare them by eye
  • The bag that greedy gets wrong: 0/1 knapsack
  • Back at the protein grid: longest common subsequence

Terms it explains: greedy, 0/1 knapsack, walk back, longest common subsequence, , then, pseudo-polynomial, skips, takes.

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