One form of thenbspknapsack problemnbspis as follows we are


1. One form of the knapsack problem is as follows: We are given a set of integers, a1, a2, ... aN, and an integer, K. Is there a subset of whose sum is exactly K?

a. Give an algorithm that solves the knapsack problem in O(NK) time.

b. Why does this not show that NP?

2. You are given a currency system with coins of (decreasing) value c1, c2, ... cN cents.

a. Give an algorithm that computes the minimum number of coins required to give cents in change.

b. Give an algorithm that computes the number of different ways to give cents in change.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: One form of thenbspknapsack problemnbspis as follows we are
Reference No:- TGS01274779

Expected delivery within 24 Hours