Exercise 4 A. One greedy strategy to solve the knapsack problem is to consider the items in order of decreasing values of 'ik where Vi and Si are the value and the size of item i. For each item, add...


Exercise 4<br>A. One greedy strategy to solve the knapsack problem is to consider the items in order of<br>decreasing values of 'ik where Vi and Si are the value and the size of item i. For each item,<br>add it to the knapsack if it fits otherwise ignore it and move to the next item in the ordered<br>list. Write a complete pseudocode for this strategy. The pseudocode should print the details<br>of the solution (selected items, their total value and size).<br>Answer here:<br>B. Show that this strategy does not necessarily yield optimal solutions. Take the example of<br>exercise 1 and change the knapsack capacity to 15 (The value of the optimal solution is 54).<br>Answer here:<br>

Extracted text: Exercise 4 A. One greedy strategy to solve the knapsack problem is to consider the items in order of decreasing values of 'ik where Vi and Si are the value and the size of item i. For each item, add it to the knapsack if it fits otherwise ignore it and move to the next item in the ordered list. Write a complete pseudocode for this strategy. The pseudocode should print the details of the solution (selected items, their total value and size). Answer here: B. Show that this strategy does not necessarily yield optimal solutions. Take the example of exercise 1 and change the knapsack capacity to 15 (The value of the optimal solution is 54). Answer here:

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here