Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Week 9 : Unbonded Knapsack Problem The unbounded knapsack problem ( also known as complete knapsack problem ) is a problem which similar to 0

Week 9: Unbonded Knapsack Problem
The unbounded knapsack problem (also known as complete knapsack problem) is a problem which similar to 01 knapsack problem. Given a set of items and capacity of knapsack, asking you to maximizing total value of items that you can keep in the knapsack. The only difference is we restrict the number of item copies or not. In 01 knapsack problem, we can only decide take or not take. In unbounded knapsack problem, we don't restrict the number of item copies, in other words, you can take each item arbitrary non-negative integer times. We can define the problem I/O as below: q,
Instance: candidate items {(v1,w1),(v2,w2),dots,(vn,wn)} where (vi,wi) tuple shows item value and weight for i-th item, knapsack capacity W
Result: The maximum value (or possible combination of items) that you can keep in knapsack q,
Description
You can design your transition function similar to 01 knapsack problem. Consider capacity W and the item (vi,wi), you can peek the item at most Wwi copies.
Questions
1 We can solve above problem by dynamic programming approach, what's the transition function? Please write down your answer in recursively way.
2 Traditional DP algorithm will construct an nW table to keep subproblem solutions. We can improve the space complexity by reduce the size of cache table. Please design an algorithm to solving unbounded knapsack problem with space complexity O(W).
3 Design an algorithm to reconstruct the combination of items with O(nW) table, and analyzing its time complexity.
4 Same to Q3, but doing things with O(W).
For the implementations please use c++ language!
image text in transcribed

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

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

answer for this?

Answered: 1 week ago

Question

love of humour, often as a device to lighten the occasion;

Answered: 1 week ago

Question

orderliness, patience and seeing a task through;

Answered: 1 week ago

Question

well defined status and roles (class distinctions);

Answered: 1 week ago