Question: Suppose that we have a knapsack with total capacity of W kg. We also have n items where item j has mass wj. The knapsack
a) Devise a brute-force algorithm for solving the knapsack problem.
b) Solve the knapsack problem when the capacity of the knapsack is 18 kg and there are five items: a 5-kg sleeping bag, an 8-kg tent, a 7-kg food pack, a 4-kg container of water, and an 11-kg portable stove.
Step by Step Solution
3.47 Rating (160 Votes )
There are 3 Steps involved in it
a We want to maximize the mass of the contents of the knapsack So we can try each possible subset ... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
923-M-C-M-S (1601).docx
120 KBs Word File
