Lec 2
Lec 2
Theory
Indian Institute of
Science
Complexity classes
P and FP
Decision Problems
In the initial part of this course, we’ll focus
primarily on decision problems.
Decision Problems
In the initial part of this course, we’ll focus
primarily on decision problems.
c>
Defintion: Class P = ∪ DTIME (nc).
0
Complexity Class P
Let T: N N be some function.
c>
Defintion: Class P = ∪ DTIME (nc).
0
Deterministic polynomial-time
Complexity Class P : Examples
Cycle detection (DFS)
Check if a given graph has a cycle.
Complexity Class P : Examples
Cycle detection
Perfect matching
Maximum matching
Class
NP contains those problems (languages)
which have such efficient verifiers.
Class NP : Examples
Vertex cover
Given a graph G and an integer k, check if G
has a vertex cover of size k.
Class NP : Examples
Vertex cover
Integer factoring
Given 2 numbers n and U, check if n has a
nontrivial factor less than equal to U.
Class NP : Examples
Vertex cover
Integer factoring
Graph isomorphism
Given 2 graphs, check if they are isomorphic
Is P = NP ?
Obviously, P ⊆ NP.
L1 f(L1)
L2
L2
L1 f(L1
)
Polynomial time reduction
Definition.
We say a language L1 ⊆ {0,1}* is
polynomial time (Karp) reducible to a language
L2 ⊆ {0,1}* if there’s a polynomial time
computable function f s.t.
x∈L1 f(x)∈L2
Notation. L1 ≤p L2
For
polynomial time reductions, the question is
whether P equals NP.
Observation. L’ is NP-complete.