Professional Documents
Culture Documents
Computing
Lecture 9
NP-Complete
(Draft)
1
Lecture Outline
2
Optimization & Decision Problems
• Decision problems
– Given an input and a question regarding a problem, determine if
the answer is yes or no
• Optimization problems
– Find a solution with the “best” value
• Optimization problems can be cast as decision problems that are
easier to study
– E.g.: Shortest path: G = unweighted directed graph
• Find a path between u and v that uses the fewest edges
• Does a path exist from u to v consisting of at most k edges?
3
Class of “P” Problems
4
Complexity Class P
• Deterministic in nature
• Solved by conventional computers in polynomial time
– O(1) Constant
– O(log n) Sub-linear
– O(n) Linear
– O(n log n) Nearly Linear
– O(n2) Quadratic
– O(n3) Cubic
Deterministic Polynomial Time Algorithms (P class)
• P time algorithms
– Linear Search - O(n)
– Binary Search - O(log n)
– Bubble Sort - O(n2)
– Merge Sort - O(n log n)
– Matrix Multiplication – O(n3)
– Huffman Coding - O(nlogn)
– Single Source Shortest Path – O(ve)
– Min-Spanning Tree - O(elogv)
• As a research work more fast algorithms are required
• P is a subset of NP
Exponential Time Algorithms (EXP)
Terminologies
literal: (negated or not) Boolean variable
negation: not ()
Examples: x, x conjunction: and ()
clause: several literals connected with disjunction: or ()
Example: (xyz)
Example: (xyz)(xyz)
10
Relating the EXP-time Problems
• Since:
– Sat may reduces (converted) in P time into a Problem (L):
Sat α L (in P)
– As Sat is taken as base problem, it is NP-Hard Problem
– L is reducible by Sat in p, it becomes NP-Hard
• If there is Nondeterministic algorithm (NP) for an NP-Hard problem,
then such a problem reaches NP-Complete class.
• Nondeterministic algorithm is exist (proofed) for Sat, so, Sat is NP-Hard
and NP-Complete.
• If any NP-Hard problem has NP time algorithm, then that problem
becomes NP-Complete (NPC).
• NPC problems are the hardest NP problems
• So far, no polynomial time algorithms are found for any of NPC
problems.
• However, “P is equal to NP or not” is currently unknown
Why we study NPC?