Documents
Resources
Learning Center
Upload
Plans & pricing Sign in
Sign Out

NP Complete Problem

VIEWS: 4 PAGES: 29

									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
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 Reductions
NP-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 Reduction
       Reduction 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



       x                      T(x)        Algorithm   Yes or No
(an input for p)
                     T
                                            for Q      answer
                         An input for Q
        A Simple Reduction
Let the problem P be: given a sequence of
boolean values, does at least one of them
have the value true
Let 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=false
Clearly an algorithm to solve Q, when applied
to y1,y2,…,yn, solves P for x1,x2,…,xn

								
To top