Pham Quang Dung
Hanoi, 2012
Pham Quang Dung ()
Algorithm Analysis and Design NP-Completeness
Hanoi, 2012
1 / 31
Outline
1
Easy problems - class P Decision problems vs. Optimization problems Class NP Reductions NP-complete class
2
3
4
5
Pham Quang Dung ()
Algorithm Analysis and Design NP-Completeness
Hanoi, 2012
2 / 31
Class P: Problems that are solvable by polynomial-time algorithms (O(nk ) where n is the size of the input to the problem and k is some constant) Examples:
Sorting Shortest path problems Minimum Spanning Tree problems Maximum Flow problems ...
Pham Quang Dung ()
Algorithm Analysis and Design NP-Completeness
Hanoi, 2012
3 / 31
Outline
1
Easy problems - class P Decision problems vs. Optimization problems Class NP Reductions NP-complete class
2
3
4
5
Pham Quang Dung ()
Algorithm Analysis and Design NP-Completeness
Hanoi, 2012
4 / 31
Decision problems
Answer is “yes” or “no”
Is n a prime number? Does an undirected graph contain a hamilton cycle? Satisfiability: Given a boolean formula. Does there exist some assignment of the values 0 and 1 to its variables such that the value of the formula is 1? Subset sum problem: Given a set of integers S = {x1 , . . . , xn } and an integer T . Is there a subset of S whose sum is equal to T ?
Pham Quang Dung ()
Algorithm Analysis and Design NP-Completeness
Hanoi, 2012
5 / 31
Optimization problems
Each feasible solution is associated with a value Objective: Find a feasible solution with the best value
Shortest path problem Minimum Spanning Tree problem Traveling Salemans Problem (TSP)
Pham Quang Dung ()
Algorithm Analysis and Design NP-Completeness
Hanoi, 2012
6 / 31
Outline
1
Easy problems - class P Decision problems vs. Optimization problems Class NP Reductions NP-complete class
2
3
4
5
Pham Quang Dung ()