Course Solutions Uncategorized (Solved) : Given Sequence N Items Item Value Vi Buy Item J Buy Items J 1 J 2 Goal Maximize Sum Values Q30048403 . . . .

(Solved) : Given Sequence N Items Item Value Vi Buy Item J Buy Items J 1 J 2 Goal Maximize Sum Values Q30048403 . . . .

 

You are given a sequence of n items such that each itemi has value vi and if you buy item j youcan not buy items j + 1 or j + 2. Your goal is tomaximize the sum of the values of all the items purchased.

Give an O(n) runtime algorithm to find a set of items fittingthese criteria, prove the correctness of your algorithm, andanalyze its runtime.

Part 2 grading:

[10 points] Algorithm: Your algorithm generally has a correctidea and has a runtime of O(n)

[20 points] Correctness Proof: Your algorithm is correct on allinputs, has a runtime of O(n), and your proof

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post