Theorem 7.56 SUBSET-SUM is NP Complete
ANSHUMAN MOHANTY
Theorem 7.56 SUBSET-SUM is NP Complete ANSHUMAN MOHANTY SUBSET-SUM - - PowerPoint PPT Presentation
Theorem 7.56 SUBSET-SUM is NP Complete ANSHUMAN MOHANTY SUBSET-SUM Problem Consider a set of numbers S. and a target number t. We have to determine of the exists a subset of S such that the summation of the numbers present in the subset is
Theorem 7.56 SUBSET-SUM is NP Complete
ANSHUMAN MOHANTY
SUBSET-SUM Problem
Consider a set of numbers S. and a target number t. We have to
determine of the exists a subset of S such that the summation of the numbers present in the subset is equal to t.
The subset is considered a multi-set i.e. repetitions are allowed. Thus we have,
SUBSET-SUM = {S,t| S = {x1, x2, ... xk }, and for some {y1, y2, … yk } S, we have yi = t)
NP and NP Complete
NP is the class of languages that have polynomial time verifiers. i.e.
we can verify if a given solution is true or not for a given problem in polynomial time.
A problem P is said to be NP Complete if the it belongs to NP and if
there exists a problem in NP that is reducible to P.
SUBSET-SUM is NP
SUBSET-SUM is NP Complete
The idea of the proof is to reduce 3SAT NP Complete problem to
SUBSET-SUM.
We create a 3 cnf formula to construct an instance of SUBSET-
SUM which contains a subcollection whose summation is target t.
Using variables and clauses we find structure to the SUBSET-SUM Each variable x is represented by y and z which establishes the
truth value of x in the subcollection.
Proof
Let x1 to l be the variables and c1 to k be the clauses. We construct a table with l+k columns and 2(l+k) rows. For every y, z in the i-th row, set the i-th column value as 1 and the
rest be 0.
For every y, z in the j-th row, set y = 1 for the j-th column if x is
true else set z as true. Everything else is to be set as 0.
For every g, h in the (l+j)-th row, set the j-th column as 1 and set
everything else as 0.
Set the first l columns of final row as 1 and the remaining k
columns as 3.
Subset exists if formula is satisfiable
Considering a sample Boolean expression, take yi if x is true else
take zi if x is false.
If the number of true literals in cj is at most 2, take gj If the number of true literals in cj is 1, take hj
Example
Conclusion
We can conclude that the reduction can take place in polynomial
time.
The size of the table is finite, roughly (l+k)2 and that each entry can
be easily calculated for any
The time complexity is O(n2). Thus SUBSET-SUM is NP Complete after reducing 3SAT.
Thank You