


























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Np completeness, polynomial time algorithms, and the relationship between p, np, and npc. It covers topics such as np completeness, decision and optimization problems, np-hardness, and reductions in polynomial time. The document also includes examples and proofs of np-completeness for problems like hamiltonian cycle and circuit satisfiability.
Typology: Slides
1 / 34
This page cannot be seen from the preview
Don't miss anything!



























Polynomial Time Algorithms •^
On any inputs of size n, if worst-case running timeof algorithm is O(n
k^ ), for constant k, then it is called
polynomial time algorithm
-^
Every problem can not be solved in polynomial time
-^
There exists some problems which can not besolved by any computer, in any amount of time, e.g.Turing’s Halting Problem
-^
Such problems are called un-decidable
-^
Some problems can be solved but not in O(n
k^ )
Decision problems •^
The problems which return yes or no for a given inputand a question regarding the same problem Optimization problems •^
Find a solution with best value, it can be maximum orminimum. There can be more than one solutions for it
-^
Optimization problems can be considered as decisionproblems which are easier to study.
-^
Finding a path between u and v using fewest edges inan un-weighted directed graph is O. P. but does a pathexist from u to v consisting of at most k edges is D. P.?
Class NP •^
Problems which are verifiable in polynomial time.
-^
Whether there exists or not any polynomial timealgorithm for solving such problems, we do not know.
-^
Can be solved by nondeterministic polynomial
-^
However if we are given a certificate of a solution, wecould verify that certificate is correct in polynomial time
-^
P = NP?
-^
Given:
a directed graph G = (V, E), determine a
simple cycle that contains each vertex in V, whereeach vertex can only be visited once
-^
Certificate
:
v^1
, v
, v 2
, …, v 3
n
Verification
:
, vi
i+
)^
E for i = 1, …, n-
, vn^
) 1
E
It takes polynomial time
hamiltonian not hamiltonian
Given two problems A, B, we say that A is reducible
to B in polynomial time (A
p^
B) if
f
that converts the input
of A to inputs of B in polynomial time
B(f(x)) = YES
where x is input for A and f(x) is input for B
-^
A problem A is
NP-complete
if
NP
p^
A for all B
NP
-^
If A satisfies only property No. 2 then B is
NP-hard
-^
No polynomial time algorithm has been discovered foran
NP-Complete
problem
-^
No one has ever proven that no polynomial timealgorithm can exist for any
NP-Complete
problem
Let A and B are two problems, and also supposethat we are given–^
No polynomial time algorithm exists for problem A
If we have a polynomial reduction f from A to B
Then no polynomial time algorithm exists for B
f^
Problem B
yes no
yes no
Problem A
Boolean Combinational Circuit•^
Boolean combinational elements wired together
-^
Each element takes a set of inputs and produces aset of outputs in constant number, assume binary
-^
Limit the number of outputs to 1
-^
Logic gates: NOT, AND, OR
-^
Satisfying assignment: a true assignment causingthe output to be 1.
-^
A circuit is satisfiable if it has a satisfyingassignment.
Proof:•^
Suppose X is
any problem
in NP
Construct polynomial time algorithm
that maps
every instance
x
in X to a circuit C =
f
( x
) such that
x
is YES
CIRCUIT-SAT (is satisfiable).
Since X
NP, there is a polynomial time algorithm
which verifies X.
-^
Suppose the input length is
n
and Let
( n
) denote
the worst-case running time.
-^
Let
k
be the constant such that
( n
( n
k ) and the
length of the certificate is
( n
k ).
Represent computation of
as a sequence of
configurations,
c
c
c
, c i
i +
c
T (
n )
each
c
can i^
be broken into various components
-^
c
is mapped to i^
c
i +
by the combinational circuit M
implementing the computer hardware.
-^
It is to be noted that A(x, y) = 1 or 0.
-^
Paste together all T(n) copies of the circuit M. Callthis as, F, the resultant algorithm
-^
Now it can be proved that:1.^
F correctly constructs reduction, i.e., C issatisfiable if and only if there exists a certificate y
, such that
( x
y
F runs in polynomial time
(left as an assignment)
-^
Construction of C takes
( n
k ) steps, a step takes
polynomial time
-^
F takes polynomial time to construct C from
x
Lemma 3 •^
If X is problem such that P‘
p^
X for some P'
then X is NP-hard. Moreover, X
Proof: •^
Since P’ is NPC hence for all P” in NP, we have
p^
And P‘
p^
given
By (1) and (2)
-^
p^
p^
p^
hence X is NP-hard
Now if X