Professional Documents
Culture Documents
Computational Complexity
Summer 2014
Mihalis Yannakakis
Lecture 2
Representation of Problems
Examples
0
0
0
0
1
0
0
1
0
1
0
0
1
0
1
0
0101;0010;0001;0100
Input string over A={0,1,;}
2
3
Adjacency matrix
Graph
Graph given by its list of nodes and edges:
1,2,3,4#(1,2),(1,4),(2,3),(3,4),(4,1) over A={0,9, (,),#,,}
or with node ids in binary: 1,10,11,100#(1,10),(1,100),(10,11),(11,100),(100,1)
A*
LP
Yes
instances
No
instances
- -
. . . .
Components of TM:
K : finite set of states
special states: s =start state, yes=accepting state,
no =rejecting state, h=halting state
S : Tape alphabet, includes special symbols:
left endmarker, - blank symbol
A : input alphabet S-{, -}
d : K-{yes,no,h}S KS{L,R,S} transition function
Configurations of TM
1. current state
2. tape content between and blanks (a finite string)
3. head position
Can represent for example as tuple (q,u,v) where q=current
state, u=string left and under tape head, v string right of
head (without the trailing blanks )
or as a string uqv over an extended tape alphabet SK, or
Examples
L={ x{0,1}* | x has an odd number of 1s}
Method: Move right remembering in state the parity of # 1s
seen so far
States K={q0,q1,yes,no}, s=q0
q0 q0,,R
q0,0,R
q1,1,R
no, -,S
q1,,R
q1,0,R
q0,1,R
yes, -,S
q1
Example ctd
- Every regular language can be similarly decided by a TM
that moves its head from left end to the right reading the input
(state = state of a DFA that accepts the language)
odd # 1s
TM
1
DFA
- / -,S
1
0
no
q0
0
yes
1/1,R
- / -,S
q1
1/1,R
0/0,R
0/0,R
/ ,R
/ ,R
Some variants:
Head moves left or right but does not stay in place
Machine does not ever write the blank symbol Two-way infinite tape instead of one way infinite tape
. .. .. ..