Skip to content
All tags

#knapsack

1 posts

Stanford CS161 Lecture 13: Designing Dynamic Programs for LCS, Knapsack, and Independent Set

Lecture 13 turns dynamic programming into five steps: choose a state, derive transitions, fill the table, reconstruct a solution, and then improve the implementation. LCS takes O(mn), both knapsack variants take O(nW) pseudo-polynomial time, and maximum-weight independent set on a tree takes O(|V|).