Upload
carson
View
38
Download
2
Tags:
Embed Size (px)
DESCRIPTION
Lecture 25. NP-complete Problem 2. Prof. S M Lee Department of Computer Science. Encodings An encoding "e" is a mapping from a set S to binary strings Use encodings to map abstract problems to concrete problems Example - Shortest Path 010100101010010101101100010101001010. - PowerPoint PPT Presentation
Citation preview
NP-complete Problem 2Prof. S M Lee
Department of Computer Science
Encodings
An encoding "e" is a mapping from a set S to binary strings
Use encodings to map abstract problems to concrete problems
Example - Shortest Path010100101010010101101100010101001010
Hamiltonian cycle of an undirected graph G= (V, E) is a simple cycle that contains each vertex in V
A hamiltonian graph is a graph that has a hamiltonian cycle.
Let m = |V|, it takes m! operations to determine if G= (V, E) is a hamiltonian graph
If Mary claims a graph is hamiltonian graph and provides the vertices in order on the hamiltonian cycle then we can verify her claim in polynomial time
The potential cycle is called the certificate.
Why Are We Studying NP-complete Problems?
Because we want to know what problems can be solved by computers
Polynomial ReductionsNP-complete problems are known as decision problems. This means that a specific item of input data is accepted and depending on the specific problem, it is required to determine if the instance does have the property, then the answer yes is returned; if not, then the answer no is returned
Polynomial ReductionReduction of a problem P to a problem Q: problem q’s answer for t(x) must be the same as p’s answer for x
T Algorithm for Q
x(an input for p)
T(x)
An input for Q
Yes or No answer
A Simple ReductionLet the problem P be: given a sequence of boolean values, does at least one of them have the value trueLet Q be: given a sequence of integers, is the maximum of the integer positive?Let the transformation T be defined by: t(x1,x2,…,xn)=(y1,y2,…,yn) where yi=1 if xi=true, and yi=0 if xi=falseClearly an algorithm to solve Q, when applied to y1,y2,…,yn, solves P for x1,x2,…,xn