Hi, this link refers to a Nice Dynamic Programming Problem . I am thinking how to solve this problem but haven't found any good one. Any suggestion on this problem will be a great hand.
And for future references, I ask you to provide link of this kind of problems. And also if you provide some tutorial of this kind of problems that would be great. :)
Thank you all.. Have a nice day :)
alternate link for this problem
Consider any node as the root of the tree.
Let A[i]= minimum number of tickets for subtree rooted at node i and B[i]= minimum number of tickets for subtree rooted at node i where node i can be connected to at most one node.
Note that B[i]>=A[i].
for every node i, use dp to calculate A[j] and B[j] for all children j of i. Now We can calculate A[i] and B[i] as follows: There can be at most 3 cases.
B[i] can be computed in similar way.