Question: Question 1 : Consider a rooted tree that has n vertices. A positive weight is associated with every vertex. We want to select a subset
Question : Consider a rooted tree that has n vertices. A positive weight is associated with every vertex. We want to select a subset of independent vertices so that the sum of weights of the selected vertices is the maximum. Note that, a set of vertices are independent if no pair of vertices in this set share an edge between them. hint: use dynamic programming, say fyu and fnu are the maximum weight of the independent set for the subtree rooted at node u when u is selected, and not selected, respectively. Now write optimal substructure equation for both fyu and fnu using the optimal
solution of us children.
Question : For the problem in Question now assume that weight value of all the vertices is exactly Now use a greedy algorithm to solve this problem.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
