1. Suppose we have a knapsack that can hold at most 7 pounds. The table below lists the weight and value of four items. 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. item weight value 1 2 pounds $3.00 2 3 pounds $2.00 3 4 pounds $4.00 4 5 pounds $1.00 2. Consider a special case of the 0-1 knapsack problem in which the order of the items sorted by increasing weight is the same as their order when sorted by decreasing value. Give an efficient algorithm to find an optimal solution (for this special case) that maximizes the value of the packed items. And argue that your algorithm is correct.
1. Suppose we have a knapsack that can hold at most 7 pounds. The table below lists the weight and value of four items. 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. item weight value 1 2 pounds $3.00 2 3 pounds $2.00 3 4 pounds $4.00 4 5 pounds $1.00 2. Consider a special case of the 0-1 knapsack problem in which the order of the items sorted by increasing weight is the same as their order when sorted by decreasing value. Give an efficient algorithm to find an optimal solution (for this special case) that maximizes the value of the packed items. And argue that your algorithm is correct.
Related questions
Question
Please help answer the question

Transcribed Image Text:1. Suppose we have a knapsack that can hold at most 7 pounds. The table
below lists the weight and value of four items. 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.
item
weight
value
1
2 pounds
$3.00
2
3 pounds
$2.00
3
4 pounds
$4.00
4
5 pounds
$1.00
2. Consider a special case of the 0-1 knapsack problem in which the order of
the items sorted by increasing weight is the same as their order when sorted
by decreasing value. Give an efficient algorithm to find an optimal solution
(for this special case) that maximizes the value of the packed items. And
argue that your algorithm is correct.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
