Re-rooting Tree DP?

Revision en1, by omggg, 2020-03-24 13:25:21

I am facing issues in questions in which Given is a tree with no fixed root, n<=1e5 . I can simply do the question if i traverse the tree for each node as root (n^2) but it gives TLE. I know i have to apply DP and rerooting concept.

Can anyone provide me a blog for this particular topic? Or some handful questions on that to learn with the topic? (my rating:1600)

Any help is appreciated. Thanks

Tags #dp, #trees, #graph, #dynamic programming, dp on trees, dp on graphs, re-rooting, non rooted tree


  Rev. Lang. By When Δ Comment
en1 English omggg 2020-03-24 13:25:21 424 Initial revision (published)