optional · interactive figures

16

Explore: dynamic programming

A DP table filled cell by cell, and a tree DP climbing from the leaves: both replayed from code checked against the reference solution.

optional: nothing in the lab depends on itback to the slides

16 · explore

The knapsack table, one cell at a time

Try: step and watch each cell look at the cell above and at the one a weight to the left; the last step reads the answer back. Static version: the knapsack table, filled in.

16 · explore

In and out, bottom up

Try: step up the tree, leaves first, then back down as the cover is read off. Static version: in and out, on a seven-vertex tree.