Question: 2. Inventory Management (7 points) Suppose you are playing a video game. In this game you can only carry a limited amount of items. Every

 2. Inventory Management (7 points) Suppose you are playing a video

game. In this game you can only carry a limited amount of

2. Inventory Management (7 points) Suppose you are playing a video game. In this game you can only carry a limited amount of items. Every item has a value and your goal is to maximize the total value of items you are carrying Specifically, you are choosing which of m items to carry where item number i has value vi (for your recurrence/pseudo-code you can assume you are passed the item values in an array, v, of size m) (1) Suppose you can only carry n items of the m available. (a) (1 point) Example: Let n = 3, m-5. If the item values are u = {5, 30, 17, 32, 40, which 3 should you choose to carry? (b) (1 point) Give a short description of a greedy algorithm which maximizes your total value for any given n,m, and v. (2) Suppose, the game is updated so that every item, i, now has weight, wli], in kilograms (you can assume you are passed the item weights in an array, w, of size m). You can only carry n kilograms of weight

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!