Show that the decision version of the knapsack problem is NP-complete. (Hint: In your reduction, make use of the partition problem: given n positive integers, partition them into two disjoint subsets with the same sum of their elements. The partition problem is NP-complete.)
Knapsack problem:
Knapsack is a problem in which we have two fileds. The given area is called knapsack given object. The main theme is to fill the knapsack area completely by getting a maximum profit. The mathematical representation of the knapsack is as follows:
Maximize
subjected to
where 
Here m represents the capacity of the knapsack to be fillled,
is the profit we can earn by considering the object i,
is the weight if the object i.
If
=0 the object is not consider for knapsack. If
=1 the entire object is consider for filling the knapsack.
In dynsmic programming either we use the object completely or ignoring them.We implement the problem by using principle of optimality. The mathematical representation of 0/1 knapsack problem is as follows:
Maximize
subjected to
where
The main problem of greedy method for knapsack is where we consider partially only some of the objects that are used to fill the knapsack. Where as in dynamic pogramming the object is either completely filled or completely ignored.
Procedure:
The notations used in knapsack problem are as follows:
1.
be the optimal solution, here y is the knapsack capacity,this is an
optimal solotion for filling the knapsack by considering the object
from i to j.
2.
it is a pair of
where
,
, the initial value
. We can compute
from
.
3.We can generate the sequence of decision in order to get the
optimal solution. Let
be the optimal sequence
is the suitable, we consider the object otherwise the solution is
from remaining set.
be the optimal solution then 

By using this we can compute the next sequence that is.,
to
.
In this method we have two rules
1.purging rule
2.discarding or searching rule
1.Purging rule:
If
contains
such that
and
then
can be eliminated.
2.Discarding or searching rule: It represents the remaining of a pair with less profit and more weights.
Algorithm:
Algorithm DKP(p,w,n,m)
//problem description: This is an algorithm to fill the given knapsack of capacity m by taking the given objects such that profit //will be maximized.
//input: Profits and weights of object and knapsack capacity m.
//output: The considered objects for the knapsack.
{


{



}





where
is the large
is any pair in
such that 






}
Merge is a predefined function.
Trackback is also a predefined algorithm.
Show that the decision version of the knapsack problem is NP-complete. (Hint: In your reduction, make...
Show that PARTITION is
NP-complete by reduction from SUBSET-SUM.
Given a set of integers, we say that can be partitioned if it can be split into two sets U and V so that considering all u EU and all v € V, Eu = Ev. Let PARTITION = { <S> S can be partitioned ). Show that PARTITION IS NP-complete by reduction from SUBSET-SUM.
The decision version of the Knapsack problem is as follows: Given a set of n items {1, 2, …, n}, where each item j has a value v(j) and a weight w(j), and two numbers V and W, can we find a subset X of {1, 2, …, n} such that Σj∈X v(j) ≥ V and Σj∈X w(j) ≤ W? Prove formally that the Knapsack problem is NP-complete.
Is the following problem NP-Complete? The Rice bowl problem is to pick the ingredients for your bowl. You are given a set of ingredients I1 to In. Each ingredient Ii comes with a quality qi and a quantity si . You are also given a bowl size S and a quality goal Q. Can you select a subset of the ingredients that both fit in the bowl (the sum of their si is at most S) and have enough quality...
Is the following problem NP-Complete? The Rice bowl problem is to pick the ingredients for your bowl. You are given a set of ingredients I1 to In. Each ingredient Ii comes with a quality qi and a quantity si . You are also given a bowl size S and a quality goal Q. Can you select a subset of the ingredients that both fit in the bowl (the sum of their si is at most S) and have enough quality...
Question 7 2 pts The complexity class NP-complete contains decision problems in both and Question 8 2 pts The best known solution to an NP-compete problem takes number of operations. Question 9 2 pts Is there a way to partition S = {4, 2, 6, 3, 8,5} into two sets with equal sum? Question 10 2 pts How many subsets of S = {4, 2, 6, 3,8} to 12? Question 11 2 pts The longest common sub-sequence between LIGHTSABER and...
In this assignment, you will prove that the Zero Sum problem is NP-Complete. The Zero Sum problem accepts an array of n integers and returns whether it is possible to negate some of those integers to make the array sum equal 0. For example, the array data = [1, 3, 5, 7, 9, 11] has a zero sum if you negate the 7 and 11, while the array data = [1, 2, 5, 9, 13, 22] cannot be reduced to...
Show that the following problem is NP-Complete (Hint: reduce from 3-SAT or Vertex Cover). Given an undirected graph G with positive integer distances on the edges, and two integers f and d, is there a way to select f vertices on G on which to locate firehouses, so that no vertex of G is at distance more than d from a firehouse?
Consider the following four problems: Bin Packing: Given n items with positive integer sizes s1,s2,...,sn, a capacity C for bins and a positive integer k, is it possible to pack the n items using at most k bins? Partition: Given a set S of n integers, is it possible to partition S into two subsets S1 and S2 so that the sum of the integers in S1 is equal to the sum of the integers in S2? Longest Path: Given...
5. The Hitting Set Problem (HS) is the following decision problem. Input. A finite set S, a collection (s1, s2,... , sn) of subsets of S, and a positive integer K. Question. Does there exist a subset t of S such that (a) t has exactly K members and (b) for i 1,..., n, sint6For example, suppose S # {1, 2, 3, 4, 5, 6, 7. the collection of subsets is (2.45), (34).(1,35) and K - 2. Then the answer...
(a) Suppose K is a compact subset of a metric space (X, d) and x є X but x K Show that there exist disjoint, open subsets of Gi and G2 of (X, d) such that r E Gi and KG2. (Hint: Use the version of compactness we called "having a compact topology." You will also need the Hausdorff property.) b) Now suppose that Ki and K2 are two compact, disjoint subsets of a metric space (X, d). Use (a)...