This preview shows pages 1–3. Sign up to view the full content.
1
COMPLEXITY THEORY
CSci 5403
LECTURE II: TIME COMPLEXITY
AND THE CENTRAL QUESTIONS
P =
DTIME(n
c
)
∪
c
∈
N
FIRST COMPLEXITY CLASS
P is the class of problems that can be solved
in polynomial time: they are efficiently decidable
Definition: DTIME(t(n)) = { L  L is a language
decided by a O(t(n)) time Turing Machine }
WHY
P?
Many t(n) time variants of TMs can be simulated
In time O(t(n)
c
) by a singletape TM, including:
TMs with doubleunbounded tape: O(t(n))
Multitape TMs: O(t
2
(n))
RAM Machines: O(t
6
(n))
Polynomials are the simplest class of functions
closed under composition, multiplication, etc…
They “grow slowly” compared to exponentials
EXAMPLE:
STCONN
A directed graph with n nodes…
is a set of vertices V = {1,2,…,n}
and a set of edges E
µ
V
£
V.
1
2
3
4
can be encoded as an adjacency
matrix
has a path from s to t if there are nodes i
1
, …, i
k
such that { (s,i
1
), (i
1
, i
2
),…, (i
k
, t) }
µ
E.
STCONN = {
ʪ
G,s,t
ʫ
 G has a path from s to t }
A
ij
=
1, if (i,j)
2
E
0, otherwise
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document2
STABLE
MARRIAGES
A High School has N boys and M
≥
N girls.
Each
has a ranked list of dates for the 1951 Senior Prom.
Albert
Bob
Charlie
Alice
Betty
Carol
B,C,A
A,C,B
A,B,C
B,A,C
C,A,B
C,B,A
An unstable couple prefer each other to their current dates.
STABLE = {
〈
B,G
〉
 There is a pairing with no unstable couple}
STABLE
MARRIAGES in P
Albert
Bob
Charlie
Alice
Betty
Carol
B,C,A
A,C,B
A,B,C
B,A,C
C,A,B
C,B,A
1. Each boy asks his “first choice” to the prom.
2. Each girl “accepts” her best offer – for now.
3. Repeat until every boy has a date:
a. Each boy with no date asks the next girl on his list.
b. Each girl “accepts” her new best offer – for now.
This is the end of the preview. Sign up
to
access the rest of the document.
 Spring '08
 Sturtivant,C

Click to edit the document details