Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose we have a knapsack that can hold at most 7 pounds. The table below lists the weight and value of four items weight 2

image text in transcribed

Suppose we have a knapsack that can hold at most 7 pounds. The table below lists the weight and value of four items weight 2 pounds 3 pound:s 4 pounds 5 pound:s item value 1 $2.00 4 $1.00 Use dynamic programming to solve the 0-1 knapsack problem and determine what items we should pack in the knapsack to achieve the maximum total value of packed items. Show your work 1. Now assume we can pack fractions of the items. Use a greedy algorithm to solve this fractional knapsack problem (i.e., maximizing the total value of packed items). Show your work 2. 3. Suppose that in a 0-1 knapsack problem, the order of the items when sorted by increasing weight is the same as their order when sorted by decreasing value. Give an efficient algorithm to find an optimal solution to this variant of the knapsack problem, and argue that your algorithm is correct

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Explain why saving rises as the interest rate rises.

Answered: 1 week ago