SlideShare a Scribd company logo
1 of 65
8- 1
Chapter 8
The Theory of NP-
Completeness
8- 2
 P: the class of problems which can be solved
by a deterministic polynomial algorithm.
 NP : the class of decision problem which can
be solved by a non-deterministic polynomial
algorithm.
 NP-hard: the class of problems to which every
NP problem reduces.
 NP-complete (NPC): the class of problems
which are NP-hard and belong to NP.
8- 3
Some concepts of NPC
 Definition of reduction: Problem A reduces to
problem B (A ∝ B) iff A can be solved by a
deterministic polynomial time algorithm using
a deterministic algorithm that solves B in
polynomial time.
 Up to now, none of the NPC problems can be
solved by a deterministic polynomial time
algorithm in the worst case.
 It does not seem to have any polynomial time
algorithm to solve the NPC problems.
8- 4
 The theory of NP-completeness always
considers the worst case.
 The lower bound of any NPC problem seems
to be in the order of an exponential function.
 Not all NP problems are difficult. (e.g. the
MST problem is an NP problem.)
 If A, B ∈ NPC, then A ∝ B and B ∝ A.
 Theory of NP-completeness:
If any NPC problem can be solved in polynomial
time, then all NP problems can be solved in
polynomial time. (NP = P)
8- 5
Decision problems
 The solution is simply “Yes” or “No”.
 Optimization problems are more difficult.
 e.g. the traveling salesperson problem
 Optimization version:
Find the shortest tour
 Decision version:
Is there a tour whose total length is less than or
equal to a constant c ?
8- 6
Solving an optimization problem by a
decision algorithm :
 Solving TSP optimization
problem by a decision
algorithm :
 Give c1
and test (decision algorithm)
Give c2
and test (decision algorithm)

Give cn
and test (decision algorithm)
 We can easily find the smallest ci
8- 7
The satisfiability problem
 The satisfiability problem
 The logical formula :
x1
v x2
v x3
& - x1
& - x2
the assignment :
x1
← F , x2
← F , x3
← T
will make the above formula true .
(-x1
, -x2
, x3
) represents x1
← F , x2
← F , x3
← T
8- 8
 If there is at least one assignment which
satisfies a formula, then we say that this
formula is satisfiable; otherwise, it is
unsatisfiable.
 An unsatisfiable formula :
x1
v x2
& x1
v -x2
& -x1
v x2
& -x1
v -x2
8- 9
 Definition of the satisfiability problem: Given
a Boolean formula, determine whether this
formula is satisfiable or not.
 
 A literal : xi
or -xi
 A clause : x1
v x2
v -x3
≡ Ci
 A formula : conjunctive normal form (CNF)
C1
& C2
& … & Cm
8- 10
 Resolution principle
C1
: x1
v x2
C2
: -x1
v x3
⇒ C3
: x2
v x3
 From C1
&C2
, we can
obtain C3
, and C3
can
be added into the
formula.
 The formula becomes:
C1
&C2
&C3
The resolution principle
x1
x2
x3 C1
&C2
C3
0 0 0 0 0
0 0 1 0 1
0 1 0 1 1
0 1 1 1 1
1 0 0 0 0
1 0 1 1 1
1 1 0 0 1
1 1 1 1 1
8- 11
 Another example of resolution principle
C1
: -x1
v -x2
v x3
C2
: x1
v x4
⇒ C3
: -x2
v x3
v x4
 If no new clauses can be deduced, then
it is satisfiable.
-x1
v -x2
v x3
(1)
x1
(2)
x2
(3)
(1) & (2) -x2
v x3
(4)
(4) & (3) x3
(5)
(1) & (3) -x1
v x3
(6)
8- 12
 If an empty clause is deduced, then it is
unsatisfiable.
- x1
v -x2
v x3
(1)
x1
v -x2
(2)
x2
(3)
- x3
(4)
  ⇓ deduce
  (1) & (2) -x2
v x3
(5)
(4) & (5) -x2
(6)
(6) & (3) □ (7)
8- 13
Semantic tree
 In a semantic tree, each
path from the root to a
leaf node represents a
class of assignments.
 If each leaf node is
attached with a clause,
then it is unsatisfiable.
8- 14
Nondeterministic algorithms
 A nondeterminstic algorithm consists of
phase 1: guessing
phase 2: checking
 If the checking stage of a nondeterministic
algorithm is of polynomial time-complexity, then
this algorithm is called an NP (nondeterministic
polynomial) algorithm.
 NP problems : (must be decision problems)
 e.g. searching, MST
sorting
satisfiability problem (SAT)
traveling salesperson problem (TSP)
8- 15
Decision problems
 Decision version of sorting:
Given a1
, a2
,…, an
and c, is there a permutation
of ai
′
s ( a1
′
, a2
′
, … ,an
′
) such that∣a2
′
–a1
′
∣+∣a3
′
–a2
′
∣+
… +∣an
′
–an-1
′
∣ < c ?
 Not all decision problems are NP problems
 E.g. halting problem :

Given a program with a certain input data, will
the program terminate or not?

NP-hard

Undecidable
8- 16
Nondeterministic operations
and functions
[Horowitz 1998]
 Choice(S) : arbitrarily chooses one of the elements in set
S
 Failure : an unsuccessful completion
 Success : a successful completion
 Nonderministic searching algorithm:
j ← choice(1 : n) /* guessing */
if A(j) = x then success /* checking */
else failure
8- 17
 A nondeterministic algorithm terminates
unsuccessfully iff there does not exist a set of
choices leading to a success signal.
 The time required for choice(1 : n) is O(1).
 A deterministic interpretation of a non-
deterministic algorithm can be made by
allowing unbounded parallelism in
computation.
8- 18
Nondeterministic sorting
B ← 0
/* guessing */
for i = 1 to n do
j ← choice(1 : n)
if B[j] ≠ 0 then failure
B[j] = A[i]
/* checking */
for i = 1 to n-1 do
if B[i] > B[i+1] then failure
success
8- 19
Nondeterministic SAT
/* guessing */
for i = 1 to n do
xi ← choice( true, false )
/* checking */
if E(x1, x2, … ,xn) is true then success
else failure
8- 20
Cook’s theorem
NP = P iff the satisfiability
problem is a P problem.
 SAT is NP-complete.
 It is the first NP-complete
problem.
 Every NP problem reduces
to SAT.
Stephen Arthur
Cook
(1939~)
8- 21
Transforming searching to SAT
 Does there exist a number in { x(1),
x(2), …, x(n) }, which is equal to 7?
 Assume n = 2.
nondeterministic algorithm:
i = choice(1,2)
if x(i)=7 then SUCCESS
else FAILURE
8- 22
i=1 v i=2
& i=1 → i≠2
& i=2 → i≠1
& x(1)=7 & i=1 → SUCCESS
& x(2)=7 & i=2 → SUCCESS
& x(1)≠7 & i=1 → FAILURE
& x(2)≠7 & i=2 → FAILURE
& FAILURE → -SUCCESS
& SUCCESS (Guarantees a successful
termination)
& x(1)=7 (Input Data)
& x(2)≠7
8- 23
 CNF (conjunctive normal form) :
i=1 v i=2 (1)
i≠1 v i≠2 (2)
x(1)≠7 v i≠1 v SUCCESS (3)
x(2)≠7 v i≠2 v SUCCESS (4)
x(1)=7 v i≠1 v FAILURE (5)
x(2)=7 v i≠2 v FAILURE (6)
-FAILURE v -SUCCESS (7)
SUCCESS (8)
x(1)=7 (9)
x(2)≠7 (10)
8- 24
 Satisfiable at the following assignment :
i=1 satisfying (1)
i≠2 satisfying (2), (4) and (6)
SUCCESS satisfying (3), (4) and (8)
−FAILURE satisfying (7)
x(1)=7 satisfying (5) and (9)
x(2)≠7 satisfying (4) and (10)
8- 25
The semantic tree
i=1 v i=2 (1)
i≠1 v i≠2 (2)
x(1)≠7 v i≠1 v SUCCESS (3)
x(2)≠7 v i≠2 v SUCCESS (4)
x(1)=7 v i≠1 v FAILURE (5)
x(2)=7 v i≠2 v FAILURE (6)
-FAILURE v -SUCCESS (7)
SUCCESS (8)
x(1)=7 (9)
x(2)≠7 (10)
8- 26
Searching for 7, but x(1)≠7, x(2)≠7

CNF (conjunctive normal form) :
i=1 v i=2 (1)
i≠1 v i≠2 (2)
x(1)≠7 v i≠1 v SUCCESS (3)
x(2)≠7 v i≠2 v SUCCESS (4)
x(1)=7 v i≠1 v FAILURE (5)
x(2)=7 v i≠2 v FAILURE (6)
SUCCESS (7)
-SUCCESS v -FAILURE (8)
x(1) ≠ 7 (9)
x(2) ≠ 7 (10)
8- 27
 Apply resolution principle :
(9) & (5) i≠1 v FAILURE (11)
(10) & (6) i≠2 v FAILURE (12)
(7) & (8) -FAILURE (13)
(13) & (11) i≠1 (14)
(13) & (12) i≠2 (15)
(14) & (1) i=2 (11)
(15) & (16) □ (17)
We get an empty clause ⇒ unsatisfiable
⇒ 7 does not exit in x(1) or x(2).
8- 28
 CNF:
i=1 v i=2 (1)
i≠1 v i≠2 (2)
x(1)≠7 v i≠1 v S U C C E S S (3 )
x(2)≠7 v i≠2 v S U C C E S S (4 )
x(1)=7 v i≠1 v FA I L U R E ( 5 )
x(2)=7 v i≠2 v FA I L U R E ( 6 )
SUCCESS (7)
-SUCCESS v -FAILURE (8)
x(1)=7 (9)
x(2)=7 (10)
Searching for 7, where x(1)=7, x(2)=7
8- 29
The semantic
tree
It implies that both assignments (i=1, i=2) satisfy the
clauses.
8- 30
The node cover problem
 Def: Given a graph G=(V, E), S is the node
cover if S ⊆ V and for every edge (u, v) ∈ E,
either u ∈ S or v ∈ S.
node cover :
{1, 3}
{5, 2, 4}
 Decision problem : ∃ S ∋ | S | ≤ K ?
8- 31
Transforming the node cover
problem to SAT
BEGIN
i1 ← choice({1, 2, …, n})
i2 ← choice({1, 2, …, n} – {i1})

ik ← choice({1, 2, …, n} – {i1, i2, …, ik-1}).
For j=1 to m do
BEGIN
if ej is not incident to one of νit
(1≤t≤k)
then FAILURE
END
SUCCESS
8- 32
i1 = 1 v i1 = 2… v i1 = n
(i1≠ 1→i1=2 v i1=3…v i1 = n)
i2 = 1 v i2 = 2… v i2 = n

ik = 1 v ik = 2… v ik = n
i1 ≠1 v i2 ≠1 (i1=1 →i2≠1 & ... & ik≠1)
i1 ≠1 v i3 ≠1

ik-1 ≠n v ik ≠n
νi1
∈e1 v νi2
∈e1 v … v νik
∈e1 v FAILURE
(νi1
∉e1&νi2
∉e1&…&νik
∉e1→ Failure)
νi1
∈e2 v νi2
∈e2 v … v νik
∈e2 v FAILURE

νi1
∈em v νi2
∈em v … v νik
∈em v FAILURE
SUCCESS
CN
F:
(To be continued)
8- 33
-SUCCESS v -FAILURE
νr1
∈e1
νs1
∈e1
νr2
∈e2
νs2
∈e2

νrm
∈em
νsm
∈em
8- 34
SAT is NP-complete
(1) SAT has an NP algorithm.
(2) SAT is NP-hard:
 Every NP algorithm for problem A can be
transformed in polynomial time to SAT
[Horowitz 1998] such that SAT is satisfiable
if and only if the answer for A is “YES”.
 That is, every NP problem ∝ SAT .
 By (1) and (2), SAT is NP-complete.
8- 35
Proof of NP-Completeness
 To show that A is NP-complete
(I) Prove that A is an NP problem.
(II) Prove that ∃ B ∈ NPC, B ∝ A.
⇒ A ∈ NPC
 Why ?
8- 36
3-satisfiability problem (3-
SAT)
 Def: Each clause contains exactly three
literals.
 (I) 3-SAT is an NP problem (obviously)
 (II) SAT ∝ 3-SAT
Proof:
(1) One literal L1
in a clause in SAT :
in 3-SAT :
L1
v y1
v y2
L1
v -y1
v y2
L1
v y1
v -y2
L1
v -y1
v -y2
8- 37
(2) Two literals L1
, L2
in a clause in SAT :
in 3-SAT :
L1
v L2
v y1
L1
v L2
v -y1
(3) Three literals in a clause : remain unchanged.
(4) More than 3 literals L1
, L2
, …, Lk
in a clause :
in 3-SAT :
L1
v L2
v y1
L3
v -y1
v y2

Lk-2
v -yk-4
v yk-3
Lk-1
v Lk
v -yk-3
8- 38
SAT transform
3-SAT
S S′
 The instance S′ in 3-
SAT :
x1
v x2
v y1
x1
v x2
v -y1
-x3
v y2
v y3
-x3
v -y2
v y3
-x3
v y2
v -y3
-x3
v -y2
v -y3
x1
v -x2
v y4
x3
v -y4
v y5
-x4
v -y5
v y6
x5
v x6
v -y6
 An instance S in SAT :
x1
v x2
-x3
x1
v -x2
v x3
v -x4
v x5
v x6
Example of transforming SAT to 3-
SAT
8- 39
 Proof : S is satisfiable ⇔ S′ is satisfiable
“⇒”
≤ 3 literals in S (trivial)
consider ≥ 4 literals
S : L1
v L2
v … v Lk
S′: L1
v L2
v y1
L3
v -y1
v y2
L4
v -y2
v y3

Lk-2
v -yk-4
v yk-3
Lk-1
v Lk
v -yk-3
8- 40
 S is satisfiable ⇒ at least Li
= T
Assume : Lj
= F ∀ j ≠ i
assign : yi-1
= F
yj
= T ∀ j < i-1
yj
= F ∀ j > i-1
( Li
v -yi-2
v yi-1
)
⇒ S′ is satisfiable.
 “⇐”
If S′ is satisfiable, then assignment satisfying
S′ can not contain yi
’s only.
⇒ at least one Li
must be true.
(We can also apply the resolution principle).
Thus, 3-SAT is NP-complete.
8- 41
Comment for 3-SAT
 If a problem is NP-complete, its special cases
may or may not be NP-complete.
8- 42
Chromatic number decision
problem (CN)
 Def: A coloring of a graph G=(V, E) is a function
f : V → { 1, 2, 3,…, k } such that if (u, v) ∈ E, then
f(u)≠f(v). The CN problem is to determine if G has a
coloring for k.
<Theorem> Satisfiability with at most 3 literals per
clause (SATY) ∝ CN.
3-colorable
f(a)=1, f(b)=2, f(c)=1
f(d)=2, f(e)=3
8- 43
Proof :
instance of SATY :
variable : x1, x2, …, xn , n ≥ 4
clause : c1, c2, …, cr
instance of CN :
G=(V, E)
V={ x1, x2, …, xn }∪{ -x1, -x2, …, -xn }
∪{ y1, y2, …, yn }∪{ c1, c2, …, cr }

newly added
E={ (xi, -xi) | 1≤ i ≤ n }∪{ (yi, yj) | i ≠ j }
∪{ (yi, xj) | i ≠ j }∪{ (yi, -xj) | i ≠ j }
∪{ (xi, cj) | xi ∉ cj }∪{ (-xi, cj) | -xi ∉ cj }
SATY ∝ CN
8- 44
x1
v x2
v x3
(1)
-x3
v -x4
v x2
(2)
⇓
Example of SATY ∝ CN
True assignment:
x1
=T
x2
=F
x3
=F
x4
=T
E={ (xi
, -xi
) | 1≤ i ≤ n }∪{ (yi
, yj
) | i ≠ j }
∪{ (yi
, xj
) | i ≠ j }∪{ (yi
, -xj
) | i ≠ j }
∪{ (xi
, cj
) | xi
∉ cj
}∪{ (-xi
, cj
) | -xi
∉ cj
}
8- 45
 Satisfiable ⇔ n+1 colorable
 “⇒”
(1) f(yi
) = i
(2) if xi
= T, then f(xi
) = i, f(-xi
) = n+1
else f(xi
) = n+1, f(-xi
) = i
(3)if xi
in cj
and xi
= T, then f(cj
) = f(xi
)
if -xi
in cj
and -xi
= T, then f(cj
) = f(-xi
)
( at least one such xi
)
Proof of SATY ∝ CN
8- 46
 “⇐”
(1) yi
must be assigned with color i.
(2) f(xi
) ≠ f(-xi
)
either f(xi
) = i and f(-xi
) = n+1
or f(xi
) = n+1 and f(-xi
) = i
(3) at most 3 literals in cj
and n ≥ 4
⇒ at least one xi
, ∋ xi
and -xi
are not in cj
⇒ f(cj
) ≠ n+1
(4) if f(cj
) = i = f(xi
), assign xi
to T
if f(cj
) = i = f(-xi
), assign -xi
to T
(5) if f(cj
) = i = f(xi
) ⇒ (cj
, xi
) ∉ E
⇒ xi
in cj
⇒ cj
is true
if f(cj
) = i = f(-xi
) ⇒ similarly
8- 47
Set cover decision problem
 Def: F = {Si
} = { S1
, S2
, …, Sk
}
= { u1
, u2
, …, un
}
T is a set cover of F if T ⊆ F and
The set cover decision problem is to determine if F has
a cover T containing no more than c sets.
 Example
F = {(u1
, u3
), (u2
, u4
), (u2
, u3
), (u4
), (u1
, u3
, u4
)}
s1
s2
s3
s4
s5
T = { s1
, s3
, s4
} set cover
T = { s1
, s2
} set cover, exact cover
FS
i
i
S
∈

FS
i
TS
i
ii
SS
∈∈
=
8- 48
Exact cover problem
(Notations same as those in set cover.)
Def: To determine if F has an exact cover T,
which is a cover of F and the sets in T are
pairwise disjoint.
<Theorem> CN ∝ exact cover
(No proof here.)
8- 49
Sum of subsets problem
 Def: A set of positive numbers A = { a1
, a2
, …,
an
}
a constant C
Determine if ∃ A′ ⊆ A ∋
 e.g. A = { 7, 5, 19, 1, 12, 8, 14 }
 C = 21, A′ = { 7, 14 }
 C = 11, no solution
<Theorem> Exact cover ∝ sum of subsets.
Ca
Aa
i
i
=∑′∈
8- 50
 Proof :
instance of exact cover :
F = { S1
, S2
, …, Sk
}
instance of sum of subsets :
A = { a1
, a2
, …, ak
} where
where eij
= 1 if uj
∈ Si
eij
= 0 if otherwise.
 Why k+1? (See the example on the next page.)
Exact cover ∝ sum of subsets
{ }
FS
ni
i
uuuS
∈
= ...,,2,1
j
nj
iji kea )1(
1
+= ∑≤≤
kkkkC n
nj
j
/)1)1)((1()1(
1
−++=+= ∑≤≤
8- 51
Example of Exact cover ∝ sum of
subsets
 Valid transformation:
u1=6, u2=8, u3=9, n=3
EC: S1={6,8}, S2={9},
S3={6,9}, S4={8,9}
k=4
SS: a1=51
+52
=30
a2=53
=125
a3=51
+53
=130
a4=52
+53
=150
 Invalid transformation:
EC: S1={6,8}, S2={8}, S3={8},
S4={8,9}. K=4
Suppose k-2=2 is used.
SS: a1=21
+22
=6
a2=22
=4
a3=22
=4
a4=22
+23
=12
C=21
+22
+23
=14
{ } { }9,8,6...,,2,1 ==
∈

FS
ni
i
uuuS
8- 52
Partition problem
 Def: Given a set of positive numbers A =
{ a1
,a2
,…,an
},
determine if ∃ a partition P, ∋
 e. g. A = {3, 6, 1, 9, 4, 11}
partition : {3, 1, 9, 4} and {6, 11}
<Theorem> sum of subsets ∝ partition
∑∑ ∉∈
=
Pa
i
Pa
i
ii
aa
8- 53
Sum of subsets ∝ partition
proof :
instance of sum of subsets :
A = { a1, a2, …, an }, C
instance of partition :
B = { b1, b2, …, bn+2 }, where bi = ai, 1≤ i ≤ n
bn+1 = C+1
bn+2 = ( ∑ ai )+1−C
1≤i≤n
C = ∑ai ⇔ ( ∑ai )+bn+2 = ( ∑ai )+bn+1
ai∈S ai∈S ai∉S
⇔ partition : { bi | ai∈S}∪{bn+2}
and { bi | ai∉S }∪{bn+1}
S
S’
A C
8- 54
 Why bn+1
= C+1 ? why not bn+1
= C ?
 To avoid bn+1
and bn+2
to be partitioned into
the same subset.
8- 55
Bin packing problem
 Def: n items, each of size ci
, ci
> 0
Each bin capacity : C
 Determine if we can assign the items into
k bins, ∋ ∑ci
≤ C , 1≤j≤k.
i∈binj
<Theorem> partition ∝ bin packing.
8- 56
VLSI discrete layout problem
 Given: n rectangles, each with height hi
(integer)
width wi
and an area A
Determine if there is a placement of the n
rectangles within the area A according to the rules :
1. Boundaries of rectangles parallel to x axis or y
axis.
2. Corners of rectangles lie on integer points.
3. No two rectangles overlap.
4. Two rectangles are separated by at least a unit
distance.
(See the figure on the next page.)
8- 57
A Successful Placement
<Theorem> bin packing ∝ VLSI discrete layout.
8- 58
Max clique problem
 Def: A maximal complete subgraph of a graph
G=(V,E) is a clique. The max (maximum) clique
problem is to determine the size of a largest
clique in G.
 e. g.
<Theorem> SAT ∝ clique decision problem.
maximal cliques :
{a, b}, {a, c, d}
{c, d, e, f}
maximum clique :
(largest)
{c, d, e, f}
8- 59
Node cover decision problem
 Def: A set S ⊆ V is a node cover for a graph
G = (V, E) iff all edges in E are incident to at
least one vertex in S. ∃ S, ∋ |S| ≤ K ?
<Theorem> clique decision problem ∝
node cover decision problem.
(See proof on the next page.)
8- 60
Clique decision ∝ node cover
decision
 G=(V,E) : clique Q of size k (Q⊆V)
G’=(V,E’) : node cover S of size n-k, S=V-Q
where E’={(u,v)|u∈V, v ∈V and (u,v)∉E}
8- 61
Hamiltonian cycle problem
 Def: A Hamiltonian cycle is a round trip path
along n edges of G which visits every vertex
once and returns to its starting vertex.
 e.g.
Hamiltonian cycle : 1, 2, 8, 7, 6, 5, 4, 3, 1.
<Theorem> SAT ∝ directed Hamiltonian cycle
( in a directed graph )
8- 62
Traveling salesperson problem
 Def: A tour of a directed graph G=(V,
E) is a directed cycle that includes every
vertex in V. The problem is to find a tour
of minimum cost.
<Theorem> Directed Hamiltonian cycle ∝
traveling salesperson decision problem.
(See proof on the next page.)
8- 63
Proof of Hamiltonian ∝ TSP
8- 64
0/1 knapsack problem
 Def: n objects, each with a weight wi
> 0
a profit pi
> 0
capacity of knapsack : M
Maximize ∑pi
xi
1≤i≤n
Subject to ∑wi
xi
≤ M
1≤i≤n
xi
= 0 or 1, 1≤ i ≤n
 Decision version :
Given K, ∃ ∑pi
xi
≥ K ?
1≤i≤n
 Knapsack problem : 0 ≤ xi
≤ 1, 1≤ i ≤n.
<Theorem> partition ∝ 0/1 knapsack decision
problem.
8- 65
 Refer to Sec. 11.3, Sec. 11.4 and its
exercises of [Horowitz 1998] for the proofs of
more NP-complete problems.
 [[Horowitz 1998] E. Howowitz, S. Sahni and S.
Rajasekaran, Computer Algorithms, Computer
Science Press, New York, 1998, 「台北圖書」代
理 , 02-23625376

More Related Content

What's hot

DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and boundAbhishek Singh
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translationAkshaya Arunan
 
Conceptual dependency
Conceptual dependencyConceptual dependency
Conceptual dependencyJismy .K.Jose
 
Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Shuvongkor Barman
 
Introduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityIntroduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityBhavin Darji
 
Mathematical Analysis of Recursive Algorithm.
Mathematical Analysis of Recursive Algorithm.Mathematical Analysis of Recursive Algorithm.
Mathematical Analysis of Recursive Algorithm.mohanrathod18
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsNikhil Sharma
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptarunsingh660
 
Turing Machine
Turing MachineTuring Machine
Turing MachineRajendran
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMvikas dhakane
 

What's hot (20)

Sorting
SortingSorting
Sorting
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
A* Search Algorithm
A* Search AlgorithmA* Search Algorithm
A* Search Algorithm
 
Problems, Problem spaces and Search
Problems, Problem spaces and SearchProblems, Problem spaces and Search
Problems, Problem spaces and Search
 
15 puzzle problem using branch and bound
15 puzzle problem using branch and bound15 puzzle problem using branch and bound
15 puzzle problem using branch and bound
 
Backtracking
BacktrackingBacktracking
Backtracking
 
Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translation
 
Conceptual dependency
Conceptual dependencyConceptual dependency
Conceptual dependency
 
String matching algorithms
String matching algorithmsString matching algorithms
String matching algorithms
 
8 queen problem
8 queen problem8 queen problem
8 queen problem
 
Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)Presentation on Breadth First Search (BFS)
Presentation on Breadth First Search (BFS)
 
Introduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of OptimalityIntroduction to Dynamic Programming, Principle of Optimality
Introduction to Dynamic Programming, Principle of Optimality
 
Mathematical Analysis of Recursive Algorithm.
Mathematical Analysis of Recursive Algorithm.Mathematical Analysis of Recursive Algorithm.
Mathematical Analysis of Recursive Algorithm.
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Problem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.pptProblem reduction AND OR GRAPH & AO* algorithm.ppt
Problem reduction AND OR GRAPH & AO* algorithm.ppt
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Sum of subset problem.pptx
Sum of subset problem.pptxSum of subset problem.pptx
Sum of subset problem.pptx
 
Binary Search
Binary SearchBinary Search
Binary Search
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
 

Viewers also liked

Clique Relaxation Models in Networks: Theory, Algorithms, and Applications
Clique Relaxation Models in Networks: Theory, Algorithms, and ApplicationsClique Relaxation Models in Networks: Theory, Algorithms, and Applications
Clique Relaxation Models in Networks: Theory, Algorithms, and ApplicationsSSA KPI
 
Sienna 11 graphs
Sienna 11 graphsSienna 11 graphs
Sienna 11 graphschidabdu
 
Chengqi zhang graph processing and mining in the era of big data
Chengqi zhang graph processing and mining in the era of big dataChengqi zhang graph processing and mining in the era of big data
Chengqi zhang graph processing and mining in the era of big datajins0618
 
Sienna 12 huffman
Sienna 12 huffmanSienna 12 huffman
Sienna 12 huffmanchidabdu
 
Undecidable Problem
Undecidable ProblemUndecidable Problem
Undecidable ProblemMGoodhew
 
Decidability of Finiteness of a Context Free Grammer
Decidability of Finiteness of a Context Free GrammerDecidability of Finiteness of a Context Free Grammer
Decidability of Finiteness of a Context Free GrammerZeeshan Masood S
 
lecture 30
lecture 30lecture 30
lecture 30sajinsc
 
Algorithm chapter 10
Algorithm chapter 10Algorithm chapter 10
Algorithm chapter 10chidabdu
 
Clustering of graphs and search of assemblages
Clustering of graphs and search of assemblagesClustering of graphs and search of assemblages
Clustering of graphs and search of assemblagesData-Centric_Alliance
 
Decidability
DecidabilityDecidability
Decidabilityandrejko
 
Maximum clique detection algorithm
Maximum clique detection algorithmMaximum clique detection algorithm
Maximum clique detection algorithmAbhishek Kona
 
Deciability (automata presentation)
Deciability (automata presentation)Deciability (automata presentation)
Deciability (automata presentation)Sagar Kumar
 

Viewers also liked (17)

Np complete
Np completeNp complete
Np complete
 
Clique Relaxation Models in Networks: Theory, Algorithms, and Applications
Clique Relaxation Models in Networks: Theory, Algorithms, and ApplicationsClique Relaxation Models in Networks: Theory, Algorithms, and Applications
Clique Relaxation Models in Networks: Theory, Algorithms, and Applications
 
Sienna 11 graphs
Sienna 11 graphsSienna 11 graphs
Sienna 11 graphs
 
Chengqi zhang graph processing and mining in the era of big data
Chengqi zhang graph processing and mining in the era of big dataChengqi zhang graph processing and mining in the era of big data
Chengqi zhang graph processing and mining in the era of big data
 
Sienna 12 huffman
Sienna 12 huffmanSienna 12 huffman
Sienna 12 huffman
 
Undecidable Problem
Undecidable ProblemUndecidable Problem
Undecidable Problem
 
Decidability of Finiteness of a Context Free Grammer
Decidability of Finiteness of a Context Free GrammerDecidability of Finiteness of a Context Free Grammer
Decidability of Finiteness of a Context Free Grammer
 
lecture 30
lecture 30lecture 30
lecture 30
 
Algorithm chapter 10
Algorithm chapter 10Algorithm chapter 10
Algorithm chapter 10
 
Finding Dense Subgraphs
Finding Dense SubgraphsFinding Dense Subgraphs
Finding Dense Subgraphs
 
Clustering of graphs and search of assemblages
Clustering of graphs and search of assemblagesClustering of graphs and search of assemblages
Clustering of graphs and search of assemblages
 
Decidability
DecidabilityDecidability
Decidability
 
Maximum clique detection algorithm
Maximum clique detection algorithmMaximum clique detection algorithm
Maximum clique detection algorithm
 
Deciability (automata presentation)
Deciability (automata presentation)Deciability (automata presentation)
Deciability (automata presentation)
 
Np hard
Np hardNp hard
Np hard
 
NP completeness
NP completenessNP completeness
NP completeness
 
P versus NP
P versus NPP versus NP
P versus NP
 

Similar to Np cooks theorem

IIT JAM Mathematical Statistics - MS 2022 | Sourav Sir's Classes
IIT JAM Mathematical Statistics - MS 2022 | Sourav Sir's ClassesIIT JAM Mathematical Statistics - MS 2022 | Sourav Sir's Classes
IIT JAM Mathematical Statistics - MS 2022 | Sourav Sir's ClassesSOURAV DAS
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2S.Shayan Daneshvar
 
IIT JAM Math 2022 Question Paper | Sourav Sir's Classes
IIT JAM Math 2022 Question Paper | Sourav Sir's ClassesIIT JAM Math 2022 Question Paper | Sourav Sir's Classes
IIT JAM Math 2022 Question Paper | Sourav Sir's ClassesSOURAV DAS
 
Nbhm m. a. and m.sc. scholarship test 2007
Nbhm m. a. and m.sc. scholarship test 2007 Nbhm m. a. and m.sc. scholarship test 2007
Nbhm m. a. and m.sc. scholarship test 2007 MD Kutubuddin Sardar
 
Informe laboratorio n°1
Informe laboratorio n°1Informe laboratorio n°1
Informe laboratorio n°1luisescobedo38
 
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docxDivide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docxjacksnathalie
 
Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Fabian Pedregosa
 
GATE Mathematics Paper-2000
GATE Mathematics Paper-2000GATE Mathematics Paper-2000
GATE Mathematics Paper-2000Dips Academy
 
ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)CrackDSE
 
2012 mdsp pr13 support vector machine
2012 mdsp pr13 support vector machine2012 mdsp pr13 support vector machine
2012 mdsp pr13 support vector machinenozomuhamada
 
Ip 5 discrete mathematics
Ip 5 discrete mathematicsIp 5 discrete mathematics
Ip 5 discrete mathematicsMark Simon
 
ملزمة الرياضيات للصف السادس التطبيقي الفصل الاول الاعداد المركبة 2022
 ملزمة الرياضيات للصف السادس التطبيقي الفصل الاول الاعداد المركبة 2022 ملزمة الرياضيات للصف السادس التطبيقي الفصل الاول الاعداد المركبة 2022
ملزمة الرياضيات للصف السادس التطبيقي الفصل الاول الاعداد المركبة 2022anasKhalaf4
 

Similar to Np cooks theorem (20)

IIT JAM Mathematical Statistics - MS 2022 | Sourav Sir's Classes
IIT JAM Mathematical Statistics - MS 2022 | Sourav Sir's ClassesIIT JAM Mathematical Statistics - MS 2022 | Sourav Sir's Classes
IIT JAM Mathematical Statistics - MS 2022 | Sourav Sir's Classes
 
Soluciones quiz
Soluciones quizSoluciones quiz
Soluciones quiz
 
P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2P, NP and NP-Complete, Theory of NP-Completeness V2
P, NP and NP-Complete, Theory of NP-Completeness V2
 
IIT JAM Math 2022 Question Paper | Sourav Sir's Classes
IIT JAM Math 2022 Question Paper | Sourav Sir's ClassesIIT JAM Math 2022 Question Paper | Sourav Sir's Classes
IIT JAM Math 2022 Question Paper | Sourav Sir's Classes
 
Nbhm m. a. and m.sc. scholarship test 2007
Nbhm m. a. and m.sc. scholarship test 2007 Nbhm m. a. and m.sc. scholarship test 2007
Nbhm m. a. and m.sc. scholarship test 2007
 
5.1 greedy
5.1 greedy5.1 greedy
5.1 greedy
 
Randomized algorithms ver 1.0
Randomized algorithms ver 1.0Randomized algorithms ver 1.0
Randomized algorithms ver 1.0
 
Informe laboratorio n°1
Informe laboratorio n°1Informe laboratorio n°1
Informe laboratorio n°1
 
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docxDivide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
Divide-and-Conquer & Dynamic ProgrammingDivide-and-Conqu.docx
 
Signals and Systems Homework Help.pptx
Signals and Systems Homework Help.pptxSignals and Systems Homework Help.pptx
Signals and Systems Homework Help.pptx
 
Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3Random Matrix Theory and Machine Learning - Part 3
Random Matrix Theory and Machine Learning - Part 3
 
GATE Mathematics Paper-2000
GATE Mathematics Paper-2000GATE Mathematics Paper-2000
GATE Mathematics Paper-2000
 
05_AJMS_332_21.pdf
05_AJMS_332_21.pdf05_AJMS_332_21.pdf
05_AJMS_332_21.pdf
 
m.tech final
m.tech finalm.tech final
m.tech final
 
ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)ISI MSQE Entrance Question Paper (2008)
ISI MSQE Entrance Question Paper (2008)
 
2012 mdsp pr13 support vector machine
2012 mdsp pr13 support vector machine2012 mdsp pr13 support vector machine
2012 mdsp pr13 support vector machine
 
Aieee mathematics- 2010
Aieee mathematics- 2010Aieee mathematics- 2010
Aieee mathematics- 2010
 
Ip 5 discrete mathematics
Ip 5 discrete mathematicsIp 5 discrete mathematics
Ip 5 discrete mathematics
 
ملزمة الرياضيات للصف السادس التطبيقي الفصل الاول الاعداد المركبة 2022
 ملزمة الرياضيات للصف السادس التطبيقي الفصل الاول الاعداد المركبة 2022 ملزمة الرياضيات للصف السادس التطبيقي الفصل الاول الاعداد المركبة 2022
ملزمة الرياضيات للصف السادس التطبيقي الفصل الاول الاعداد المركبة 2022
 
4th Semester CS / IS (2013-June) Question Papers
4th Semester CS / IS (2013-June) Question Papers 4th Semester CS / IS (2013-June) Question Papers
4th Semester CS / IS (2013-June) Question Papers
 

Recently uploaded

Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 

Recently uploaded (20)

Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 

Np cooks theorem

  • 1. 8- 1 Chapter 8 The Theory of NP- Completeness
  • 2. 8- 2  P: the class of problems which can be solved by a deterministic polynomial algorithm.  NP : the class of decision problem which can be solved by a non-deterministic polynomial algorithm.  NP-hard: the class of problems to which every NP problem reduces.  NP-complete (NPC): the class of problems which are NP-hard and belong to NP.
  • 3. 8- 3 Some concepts of NPC  Definition of reduction: Problem A reduces to problem B (A ∝ B) iff A can be solved by a deterministic polynomial time algorithm using a deterministic algorithm that solves B in polynomial time.  Up to now, none of the NPC problems can be solved by a deterministic polynomial time algorithm in the worst case.  It does not seem to have any polynomial time algorithm to solve the NPC problems.
  • 4. 8- 4  The theory of NP-completeness always considers the worst case.  The lower bound of any NPC problem seems to be in the order of an exponential function.  Not all NP problems are difficult. (e.g. the MST problem is an NP problem.)  If A, B ∈ NPC, then A ∝ B and B ∝ A.  Theory of NP-completeness: If any NPC problem can be solved in polynomial time, then all NP problems can be solved in polynomial time. (NP = P)
  • 5. 8- 5 Decision problems  The solution is simply “Yes” or “No”.  Optimization problems are more difficult.  e.g. the traveling salesperson problem  Optimization version: Find the shortest tour  Decision version: Is there a tour whose total length is less than or equal to a constant c ?
  • 6. 8- 6 Solving an optimization problem by a decision algorithm :  Solving TSP optimization problem by a decision algorithm :  Give c1 and test (decision algorithm) Give c2 and test (decision algorithm)  Give cn and test (decision algorithm)  We can easily find the smallest ci
  • 7. 8- 7 The satisfiability problem  The satisfiability problem  The logical formula : x1 v x2 v x3 & - x1 & - x2 the assignment : x1 ← F , x2 ← F , x3 ← T will make the above formula true . (-x1 , -x2 , x3 ) represents x1 ← F , x2 ← F , x3 ← T
  • 8. 8- 8  If there is at least one assignment which satisfies a formula, then we say that this formula is satisfiable; otherwise, it is unsatisfiable.  An unsatisfiable formula : x1 v x2 & x1 v -x2 & -x1 v x2 & -x1 v -x2
  • 9. 8- 9  Definition of the satisfiability problem: Given a Boolean formula, determine whether this formula is satisfiable or not.    A literal : xi or -xi  A clause : x1 v x2 v -x3 ≡ Ci  A formula : conjunctive normal form (CNF) C1 & C2 & … & Cm
  • 10. 8- 10  Resolution principle C1 : x1 v x2 C2 : -x1 v x3 ⇒ C3 : x2 v x3  From C1 &C2 , we can obtain C3 , and C3 can be added into the formula.  The formula becomes: C1 &C2 &C3 The resolution principle x1 x2 x3 C1 &C2 C3 0 0 0 0 0 0 0 1 0 1 0 1 0 1 1 0 1 1 1 1 1 0 0 0 0 1 0 1 1 1 1 1 0 0 1 1 1 1 1 1
  • 11. 8- 11  Another example of resolution principle C1 : -x1 v -x2 v x3 C2 : x1 v x4 ⇒ C3 : -x2 v x3 v x4  If no new clauses can be deduced, then it is satisfiable. -x1 v -x2 v x3 (1) x1 (2) x2 (3) (1) & (2) -x2 v x3 (4) (4) & (3) x3 (5) (1) & (3) -x1 v x3 (6)
  • 12. 8- 12  If an empty clause is deduced, then it is unsatisfiable. - x1 v -x2 v x3 (1) x1 v -x2 (2) x2 (3) - x3 (4)   ⇓ deduce   (1) & (2) -x2 v x3 (5) (4) & (5) -x2 (6) (6) & (3) □ (7)
  • 13. 8- 13 Semantic tree  In a semantic tree, each path from the root to a leaf node represents a class of assignments.  If each leaf node is attached with a clause, then it is unsatisfiable.
  • 14. 8- 14 Nondeterministic algorithms  A nondeterminstic algorithm consists of phase 1: guessing phase 2: checking  If the checking stage of a nondeterministic algorithm is of polynomial time-complexity, then this algorithm is called an NP (nondeterministic polynomial) algorithm.  NP problems : (must be decision problems)  e.g. searching, MST sorting satisfiability problem (SAT) traveling salesperson problem (TSP)
  • 15. 8- 15 Decision problems  Decision version of sorting: Given a1 , a2 ,…, an and c, is there a permutation of ai ′ s ( a1 ′ , a2 ′ , … ,an ′ ) such that∣a2 ′ –a1 ′ ∣+∣a3 ′ –a2 ′ ∣+ … +∣an ′ –an-1 ′ ∣ < c ?  Not all decision problems are NP problems  E.g. halting problem :  Given a program with a certain input data, will the program terminate or not?  NP-hard  Undecidable
  • 16. 8- 16 Nondeterministic operations and functions [Horowitz 1998]  Choice(S) : arbitrarily chooses one of the elements in set S  Failure : an unsuccessful completion  Success : a successful completion  Nonderministic searching algorithm: j ← choice(1 : n) /* guessing */ if A(j) = x then success /* checking */ else failure
  • 17. 8- 17  A nondeterministic algorithm terminates unsuccessfully iff there does not exist a set of choices leading to a success signal.  The time required for choice(1 : n) is O(1).  A deterministic interpretation of a non- deterministic algorithm can be made by allowing unbounded parallelism in computation.
  • 18. 8- 18 Nondeterministic sorting B ← 0 /* guessing */ for i = 1 to n do j ← choice(1 : n) if B[j] ≠ 0 then failure B[j] = A[i] /* checking */ for i = 1 to n-1 do if B[i] > B[i+1] then failure success
  • 19. 8- 19 Nondeterministic SAT /* guessing */ for i = 1 to n do xi ← choice( true, false ) /* checking */ if E(x1, x2, … ,xn) is true then success else failure
  • 20. 8- 20 Cook’s theorem NP = P iff the satisfiability problem is a P problem.  SAT is NP-complete.  It is the first NP-complete problem.  Every NP problem reduces to SAT. Stephen Arthur Cook (1939~)
  • 21. 8- 21 Transforming searching to SAT  Does there exist a number in { x(1), x(2), …, x(n) }, which is equal to 7?  Assume n = 2. nondeterministic algorithm: i = choice(1,2) if x(i)=7 then SUCCESS else FAILURE
  • 22. 8- 22 i=1 v i=2 & i=1 → i≠2 & i=2 → i≠1 & x(1)=7 & i=1 → SUCCESS & x(2)=7 & i=2 → SUCCESS & x(1)≠7 & i=1 → FAILURE & x(2)≠7 & i=2 → FAILURE & FAILURE → -SUCCESS & SUCCESS (Guarantees a successful termination) & x(1)=7 (Input Data) & x(2)≠7
  • 23. 8- 23  CNF (conjunctive normal form) : i=1 v i=2 (1) i≠1 v i≠2 (2) x(1)≠7 v i≠1 v SUCCESS (3) x(2)≠7 v i≠2 v SUCCESS (4) x(1)=7 v i≠1 v FAILURE (5) x(2)=7 v i≠2 v FAILURE (6) -FAILURE v -SUCCESS (7) SUCCESS (8) x(1)=7 (9) x(2)≠7 (10)
  • 24. 8- 24  Satisfiable at the following assignment : i=1 satisfying (1) i≠2 satisfying (2), (4) and (6) SUCCESS satisfying (3), (4) and (8) −FAILURE satisfying (7) x(1)=7 satisfying (5) and (9) x(2)≠7 satisfying (4) and (10)
  • 25. 8- 25 The semantic tree i=1 v i=2 (1) i≠1 v i≠2 (2) x(1)≠7 v i≠1 v SUCCESS (3) x(2)≠7 v i≠2 v SUCCESS (4) x(1)=7 v i≠1 v FAILURE (5) x(2)=7 v i≠2 v FAILURE (6) -FAILURE v -SUCCESS (7) SUCCESS (8) x(1)=7 (9) x(2)≠7 (10)
  • 26. 8- 26 Searching for 7, but x(1)≠7, x(2)≠7  CNF (conjunctive normal form) : i=1 v i=2 (1) i≠1 v i≠2 (2) x(1)≠7 v i≠1 v SUCCESS (3) x(2)≠7 v i≠2 v SUCCESS (4) x(1)=7 v i≠1 v FAILURE (5) x(2)=7 v i≠2 v FAILURE (6) SUCCESS (7) -SUCCESS v -FAILURE (8) x(1) ≠ 7 (9) x(2) ≠ 7 (10)
  • 27. 8- 27  Apply resolution principle : (9) & (5) i≠1 v FAILURE (11) (10) & (6) i≠2 v FAILURE (12) (7) & (8) -FAILURE (13) (13) & (11) i≠1 (14) (13) & (12) i≠2 (15) (14) & (1) i=2 (11) (15) & (16) □ (17) We get an empty clause ⇒ unsatisfiable ⇒ 7 does not exit in x(1) or x(2).
  • 28. 8- 28  CNF: i=1 v i=2 (1) i≠1 v i≠2 (2) x(1)≠7 v i≠1 v S U C C E S S (3 ) x(2)≠7 v i≠2 v S U C C E S S (4 ) x(1)=7 v i≠1 v FA I L U R E ( 5 ) x(2)=7 v i≠2 v FA I L U R E ( 6 ) SUCCESS (7) -SUCCESS v -FAILURE (8) x(1)=7 (9) x(2)=7 (10) Searching for 7, where x(1)=7, x(2)=7
  • 29. 8- 29 The semantic tree It implies that both assignments (i=1, i=2) satisfy the clauses.
  • 30. 8- 30 The node cover problem  Def: Given a graph G=(V, E), S is the node cover if S ⊆ V and for every edge (u, v) ∈ E, either u ∈ S or v ∈ S. node cover : {1, 3} {5, 2, 4}  Decision problem : ∃ S ∋ | S | ≤ K ?
  • 31. 8- 31 Transforming the node cover problem to SAT BEGIN i1 ← choice({1, 2, …, n}) i2 ← choice({1, 2, …, n} – {i1})  ik ← choice({1, 2, …, n} – {i1, i2, …, ik-1}). For j=1 to m do BEGIN if ej is not incident to one of νit (1≤t≤k) then FAILURE END SUCCESS
  • 32. 8- 32 i1 = 1 v i1 = 2… v i1 = n (i1≠ 1→i1=2 v i1=3…v i1 = n) i2 = 1 v i2 = 2… v i2 = n  ik = 1 v ik = 2… v ik = n i1 ≠1 v i2 ≠1 (i1=1 →i2≠1 & ... & ik≠1) i1 ≠1 v i3 ≠1  ik-1 ≠n v ik ≠n νi1 ∈e1 v νi2 ∈e1 v … v νik ∈e1 v FAILURE (νi1 ∉e1&νi2 ∉e1&…&νik ∉e1→ Failure) νi1 ∈e2 v νi2 ∈e2 v … v νik ∈e2 v FAILURE  νi1 ∈em v νi2 ∈em v … v νik ∈em v FAILURE SUCCESS CN F: (To be continued)
  • 33. 8- 33 -SUCCESS v -FAILURE νr1 ∈e1 νs1 ∈e1 νr2 ∈e2 νs2 ∈e2  νrm ∈em νsm ∈em
  • 34. 8- 34 SAT is NP-complete (1) SAT has an NP algorithm. (2) SAT is NP-hard:  Every NP algorithm for problem A can be transformed in polynomial time to SAT [Horowitz 1998] such that SAT is satisfiable if and only if the answer for A is “YES”.  That is, every NP problem ∝ SAT .  By (1) and (2), SAT is NP-complete.
  • 35. 8- 35 Proof of NP-Completeness  To show that A is NP-complete (I) Prove that A is an NP problem. (II) Prove that ∃ B ∈ NPC, B ∝ A. ⇒ A ∈ NPC  Why ?
  • 36. 8- 36 3-satisfiability problem (3- SAT)  Def: Each clause contains exactly three literals.  (I) 3-SAT is an NP problem (obviously)  (II) SAT ∝ 3-SAT Proof: (1) One literal L1 in a clause in SAT : in 3-SAT : L1 v y1 v y2 L1 v -y1 v y2 L1 v y1 v -y2 L1 v -y1 v -y2
  • 37. 8- 37 (2) Two literals L1 , L2 in a clause in SAT : in 3-SAT : L1 v L2 v y1 L1 v L2 v -y1 (3) Three literals in a clause : remain unchanged. (4) More than 3 literals L1 , L2 , …, Lk in a clause : in 3-SAT : L1 v L2 v y1 L3 v -y1 v y2  Lk-2 v -yk-4 v yk-3 Lk-1 v Lk v -yk-3
  • 38. 8- 38 SAT transform 3-SAT S S′  The instance S′ in 3- SAT : x1 v x2 v y1 x1 v x2 v -y1 -x3 v y2 v y3 -x3 v -y2 v y3 -x3 v y2 v -y3 -x3 v -y2 v -y3 x1 v -x2 v y4 x3 v -y4 v y5 -x4 v -y5 v y6 x5 v x6 v -y6  An instance S in SAT : x1 v x2 -x3 x1 v -x2 v x3 v -x4 v x5 v x6 Example of transforming SAT to 3- SAT
  • 39. 8- 39  Proof : S is satisfiable ⇔ S′ is satisfiable “⇒” ≤ 3 literals in S (trivial) consider ≥ 4 literals S : L1 v L2 v … v Lk S′: L1 v L2 v y1 L3 v -y1 v y2 L4 v -y2 v y3  Lk-2 v -yk-4 v yk-3 Lk-1 v Lk v -yk-3
  • 40. 8- 40  S is satisfiable ⇒ at least Li = T Assume : Lj = F ∀ j ≠ i assign : yi-1 = F yj = T ∀ j < i-1 yj = F ∀ j > i-1 ( Li v -yi-2 v yi-1 ) ⇒ S′ is satisfiable.  “⇐” If S′ is satisfiable, then assignment satisfying S′ can not contain yi ’s only. ⇒ at least one Li must be true. (We can also apply the resolution principle). Thus, 3-SAT is NP-complete.
  • 41. 8- 41 Comment for 3-SAT  If a problem is NP-complete, its special cases may or may not be NP-complete.
  • 42. 8- 42 Chromatic number decision problem (CN)  Def: A coloring of a graph G=(V, E) is a function f : V → { 1, 2, 3,…, k } such that if (u, v) ∈ E, then f(u)≠f(v). The CN problem is to determine if G has a coloring for k. <Theorem> Satisfiability with at most 3 literals per clause (SATY) ∝ CN. 3-colorable f(a)=1, f(b)=2, f(c)=1 f(d)=2, f(e)=3
  • 43. 8- 43 Proof : instance of SATY : variable : x1, x2, …, xn , n ≥ 4 clause : c1, c2, …, cr instance of CN : G=(V, E) V={ x1, x2, …, xn }∪{ -x1, -x2, …, -xn } ∪{ y1, y2, …, yn }∪{ c1, c2, …, cr }  newly added E={ (xi, -xi) | 1≤ i ≤ n }∪{ (yi, yj) | i ≠ j } ∪{ (yi, xj) | i ≠ j }∪{ (yi, -xj) | i ≠ j } ∪{ (xi, cj) | xi ∉ cj }∪{ (-xi, cj) | -xi ∉ cj } SATY ∝ CN
  • 44. 8- 44 x1 v x2 v x3 (1) -x3 v -x4 v x2 (2) ⇓ Example of SATY ∝ CN True assignment: x1 =T x2 =F x3 =F x4 =T E={ (xi , -xi ) | 1≤ i ≤ n }∪{ (yi , yj ) | i ≠ j } ∪{ (yi , xj ) | i ≠ j }∪{ (yi , -xj ) | i ≠ j } ∪{ (xi , cj ) | xi ∉ cj }∪{ (-xi , cj ) | -xi ∉ cj }
  • 45. 8- 45  Satisfiable ⇔ n+1 colorable  “⇒” (1) f(yi ) = i (2) if xi = T, then f(xi ) = i, f(-xi ) = n+1 else f(xi ) = n+1, f(-xi ) = i (3)if xi in cj and xi = T, then f(cj ) = f(xi ) if -xi in cj and -xi = T, then f(cj ) = f(-xi ) ( at least one such xi ) Proof of SATY ∝ CN
  • 46. 8- 46  “⇐” (1) yi must be assigned with color i. (2) f(xi ) ≠ f(-xi ) either f(xi ) = i and f(-xi ) = n+1 or f(xi ) = n+1 and f(-xi ) = i (3) at most 3 literals in cj and n ≥ 4 ⇒ at least one xi , ∋ xi and -xi are not in cj ⇒ f(cj ) ≠ n+1 (4) if f(cj ) = i = f(xi ), assign xi to T if f(cj ) = i = f(-xi ), assign -xi to T (5) if f(cj ) = i = f(xi ) ⇒ (cj , xi ) ∉ E ⇒ xi in cj ⇒ cj is true if f(cj ) = i = f(-xi ) ⇒ similarly
  • 47. 8- 47 Set cover decision problem  Def: F = {Si } = { S1 , S2 , …, Sk } = { u1 , u2 , …, un } T is a set cover of F if T ⊆ F and The set cover decision problem is to determine if F has a cover T containing no more than c sets.  Example F = {(u1 , u3 ), (u2 , u4 ), (u2 , u3 ), (u4 ), (u1 , u3 , u4 )} s1 s2 s3 s4 s5 T = { s1 , s3 , s4 } set cover T = { s1 , s2 } set cover, exact cover FS i i S ∈  FS i TS i ii SS ∈∈ =
  • 48. 8- 48 Exact cover problem (Notations same as those in set cover.) Def: To determine if F has an exact cover T, which is a cover of F and the sets in T are pairwise disjoint. <Theorem> CN ∝ exact cover (No proof here.)
  • 49. 8- 49 Sum of subsets problem  Def: A set of positive numbers A = { a1 , a2 , …, an } a constant C Determine if ∃ A′ ⊆ A ∋  e.g. A = { 7, 5, 19, 1, 12, 8, 14 }  C = 21, A′ = { 7, 14 }  C = 11, no solution <Theorem> Exact cover ∝ sum of subsets. Ca Aa i i =∑′∈
  • 50. 8- 50  Proof : instance of exact cover : F = { S1 , S2 , …, Sk } instance of sum of subsets : A = { a1 , a2 , …, ak } where where eij = 1 if uj ∈ Si eij = 0 if otherwise.  Why k+1? (See the example on the next page.) Exact cover ∝ sum of subsets { } FS ni i uuuS ∈ = ...,,2,1 j nj iji kea )1( 1 += ∑≤≤ kkkkC n nj j /)1)1)((1()1( 1 −++=+= ∑≤≤
  • 51. 8- 51 Example of Exact cover ∝ sum of subsets  Valid transformation: u1=6, u2=8, u3=9, n=3 EC: S1={6,8}, S2={9}, S3={6,9}, S4={8,9} k=4 SS: a1=51 +52 =30 a2=53 =125 a3=51 +53 =130 a4=52 +53 =150  Invalid transformation: EC: S1={6,8}, S2={8}, S3={8}, S4={8,9}. K=4 Suppose k-2=2 is used. SS: a1=21 +22 =6 a2=22 =4 a3=22 =4 a4=22 +23 =12 C=21 +22 +23 =14 { } { }9,8,6...,,2,1 == ∈  FS ni i uuuS
  • 52. 8- 52 Partition problem  Def: Given a set of positive numbers A = { a1 ,a2 ,…,an }, determine if ∃ a partition P, ∋  e. g. A = {3, 6, 1, 9, 4, 11} partition : {3, 1, 9, 4} and {6, 11} <Theorem> sum of subsets ∝ partition ∑∑ ∉∈ = Pa i Pa i ii aa
  • 53. 8- 53 Sum of subsets ∝ partition proof : instance of sum of subsets : A = { a1, a2, …, an }, C instance of partition : B = { b1, b2, …, bn+2 }, where bi = ai, 1≤ i ≤ n bn+1 = C+1 bn+2 = ( ∑ ai )+1−C 1≤i≤n C = ∑ai ⇔ ( ∑ai )+bn+2 = ( ∑ai )+bn+1 ai∈S ai∈S ai∉S ⇔ partition : { bi | ai∈S}∪{bn+2} and { bi | ai∉S }∪{bn+1} S S’ A C
  • 54. 8- 54  Why bn+1 = C+1 ? why not bn+1 = C ?  To avoid bn+1 and bn+2 to be partitioned into the same subset.
  • 55. 8- 55 Bin packing problem  Def: n items, each of size ci , ci > 0 Each bin capacity : C  Determine if we can assign the items into k bins, ∋ ∑ci ≤ C , 1≤j≤k. i∈binj <Theorem> partition ∝ bin packing.
  • 56. 8- 56 VLSI discrete layout problem  Given: n rectangles, each with height hi (integer) width wi and an area A Determine if there is a placement of the n rectangles within the area A according to the rules : 1. Boundaries of rectangles parallel to x axis or y axis. 2. Corners of rectangles lie on integer points. 3. No two rectangles overlap. 4. Two rectangles are separated by at least a unit distance. (See the figure on the next page.)
  • 57. 8- 57 A Successful Placement <Theorem> bin packing ∝ VLSI discrete layout.
  • 58. 8- 58 Max clique problem  Def: A maximal complete subgraph of a graph G=(V,E) is a clique. The max (maximum) clique problem is to determine the size of a largest clique in G.  e. g. <Theorem> SAT ∝ clique decision problem. maximal cliques : {a, b}, {a, c, d} {c, d, e, f} maximum clique : (largest) {c, d, e, f}
  • 59. 8- 59 Node cover decision problem  Def: A set S ⊆ V is a node cover for a graph G = (V, E) iff all edges in E are incident to at least one vertex in S. ∃ S, ∋ |S| ≤ K ? <Theorem> clique decision problem ∝ node cover decision problem. (See proof on the next page.)
  • 60. 8- 60 Clique decision ∝ node cover decision  G=(V,E) : clique Q of size k (Q⊆V) G’=(V,E’) : node cover S of size n-k, S=V-Q where E’={(u,v)|u∈V, v ∈V and (u,v)∉E}
  • 61. 8- 61 Hamiltonian cycle problem  Def: A Hamiltonian cycle is a round trip path along n edges of G which visits every vertex once and returns to its starting vertex.  e.g. Hamiltonian cycle : 1, 2, 8, 7, 6, 5, 4, 3, 1. <Theorem> SAT ∝ directed Hamiltonian cycle ( in a directed graph )
  • 62. 8- 62 Traveling salesperson problem  Def: A tour of a directed graph G=(V, E) is a directed cycle that includes every vertex in V. The problem is to find a tour of minimum cost. <Theorem> Directed Hamiltonian cycle ∝ traveling salesperson decision problem. (See proof on the next page.)
  • 63. 8- 63 Proof of Hamiltonian ∝ TSP
  • 64. 8- 64 0/1 knapsack problem  Def: n objects, each with a weight wi > 0 a profit pi > 0 capacity of knapsack : M Maximize ∑pi xi 1≤i≤n Subject to ∑wi xi ≤ M 1≤i≤n xi = 0 or 1, 1≤ i ≤n  Decision version : Given K, ∃ ∑pi xi ≥ K ? 1≤i≤n  Knapsack problem : 0 ≤ xi ≤ 1, 1≤ i ≤n. <Theorem> partition ∝ 0/1 knapsack decision problem.
  • 65. 8- 65  Refer to Sec. 11.3, Sec. 11.4 and its exercises of [Horowitz 1998] for the proofs of more NP-complete problems.  [[Horowitz 1998] E. Howowitz, S. Sahni and S. Rajasekaran, Computer Algorithms, Computer Science Press, New York, 1998, 「台北圖書」代 理 , 02-23625376