Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Algorithm Homework please me help me im in need 3. (20 points) Knapsack Problem. In this problem we will revisit the 0/1 and fractional knapsack

image text in transcribed

Algorithm Homework please me help me im in need

3. (20 points) Knapsack Problem. In this problem we will revisit the 0/1 and fractional knapsack problems. Suppose that you are given the following weight/value pairs for objects to be inserted in a bag of capacity 8. item no. 1 3 4 weight value 4. 2 6 24 3 15 2 16 12 (a) (10 points) Find the optimum solution of the 0/1 knapsack problem for the above instance using dynamic programming. Determine the set of items that yield the optimum solution. Show the table and all your work. (b) (5 points) Show that a greedy algorithm using the density of items as its greedy choice will not yield the optimum solution if it is trying to solve the 0/1 knapsack problem for the above instance. Compare the value obtained by the greedy algorithm against the optimum solution. (c) (5 points) Show the output of the greedy algorithm when solving the fractional knap- sack problem for the above instance. State whether the result is an optimum solution or not

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions