Tree DP
- Stage
- 6
- Module
- M6.5
- Lessons
- 1
In this module
- Recognize problems solvable by computing values on trees with subproblem overlap.
- Root a tree and define a subproblem on each subtree.
- Compute solutions bottom-up from leaves to root.
- Rerooting: compute solutions at every node without recomputing from scratch.
Before this module
Lessons
Practice
Try this on the judge. The link opens the problem on WMOJ.
- 2022 S5Good Influencers (opens on WMOJ in a new tab) WMOJ
Keep several states per node and combine children in post-order to satisfy a tree-wide condition.