×
×

# Suppose that we have a knapsack with total capacity of w ISBN: 9780073383095 37

## Solution for problem 41E Chapter 3.SE

Discrete Mathematics and Its Applications | 7th Edition

• Textbook Solutions
• 2901 Step-by-step solutions solved by professors and subject experts
• Get 24/7 help from StudySoup virtual teaching assistants Discrete Mathematics and Its Applications | 7th Edition

4 5 1 277 Reviews
31
2
Problem 41E

Suppose that we have a knapsack with total capacity of w kg. We also have n items where item j has mass 117. The knapsack problem asks for a subset of these n items with the largest possible total mass not exceeding W.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:

Solution:Step 1:First of all, we need to devise a brute-force calculation for taking care of the knapsack problem. Give us initially a chance to talk about the knapsack problem.Step 2:Assume that we have a knapsack with an aggregate limit of W kg. We likewise have n things where thing j has mass wj. The knapsack issue requests a subset of these n things with the biggest conceivable aggregate mass, not exceeding W.Step 3:Presently we investigate what a brute-force algorithm is and the means to keep in touch with one. In a brute-force algorithm, an issue is unraveled in the clearest way in view of the announcement of the issue and the meanings of terms. brute-force algorithm is intended to take care of issues without respect to the figuring assets required. For instance, in some brute-force algorithms, the answer for an issue is found by inspecting each conceivable arrangement, searching for the most ideal.

Step 4 of 5

Step 5 of 5

##### ISBN: 9780073383095

Unlock Textbook Solution