Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started