Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The classical 0 , 1 knapsack problem is the following. We are given a set of n items. Item i has two positive integers associated

The classical 0,1 knapsack problem is the following. We are given a set of n items. Item i has two positive integers associated with it: a size s_i and a profit p_i. We are also given a knapsack of integer capacity B. The goal is to find a maximum profit subset of items that can fit into the knapsack. (A set of items fits into the knapsack if their total size is less than the capacity B.) Use dynamic programming to obtain an exact algorithm for this problem that runs in O(nB) time. Also obtain an algorithm with running time O(nP) where P=_(i=1)^np_i . Note that both these algorithms are not polynomial time algorithms. Do you see why?

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

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago

Question

2. What recommendations will you make to the city council?

Answered: 1 week ago