CS154
Streaming Algorithms
L = cfw_x | x has more 1s than 0s
Initialize C := 0 and B := 0
Read the next bit x from the stream
If (C = 0) then B := x, C := 1
If (C 0) and (B = x) then C := C + 1
If (C
CS154
Turing Machines
Turing Machine
FINITE
STATE
q1
0
CONTROL
I
A
N
P
U
T
INFINITE TAPE
1
read
write
= cfw_0
move
0 0, R
,R
qaccept
0 0, R
,R
qreject
This Turing machine decides the language cfw_0
2
CS 154
A Universal Theory of Data
Compression:
Kolmogorov Complexity
The Church-Turing Thesis:
Everyones
Intuitive Notion = Turing Machines
of Algorithms
This is not a theorem
it is a falsifiable sci
1/30/2014
CS 154
Recognizability, Decidability,
and Reductions
Definition: A Turing Machine is a 7-tuple
T = (Q, , , , q0, qaccept, qreject), where:
Q is a finite set of states
is the input alphabet,
2/6/2014
CS 154
Oracles, Rices Theorem,
the Recursion Theorem,
and the Fixed-Point Theorem
Next Thursday (2/13)
Midterm in class
Today: instead of a new homework,
youll get a practice midterm
(Dont pa
2/11/2014
CS 154
Self-Reference and
the Foundations of Mathematics
Thursday (2/13)
Midterm in class
Well allow one single-sided page of notes
Midterm will cover everything up to and including last
Thu
CS 154
NP-Complete Problems:
Theyre everywhere.
Theorem (Cook-Levin): 3SAT is NP-complete
Proof Idea:
(1) 3SAT NP (already done)
(2) Every language A in NP is polynomial time
reducible to 3SAT (this i
2/4/2014
CS 154
Reductions, Undecidability,
and the Post Correspondence
Problem
A Concrete Undecidable Problem
ATM = cfw_ (M, w) | M is a TM that accepts string w
Theorem: ATM is recognizable but NOT
CS 154
Time Complexity,
P, and NP
CS 154
Turn in homework!
New homework coming out!
Get started early
1
Complexity Theory
What can and cant be computed with limited
resources on computation,
such as t
1/9/2014
CS 154
Nondeterminism,
Finite Automata,
Regular Expressions
Read string left to right
0
0
1
0111
1
111
11
1
The DFA accepts a string if the process
ends in a double circle
1
1/9/2014
A DFA is
CS 154
More on P vs NP,
the Cook-Levin Theorem
P = TIME(nk)
kN
1
NP =
NNTIME(nk)
k
Theorem: L NP There is a constant k and
polynomial-time TM V such that
L = cfw_ x | y * [|y| |x|k and V(x,y) accepts
1/16/2014
CS154
Minimizing DFAs
CS154
Homework 1 is due!
(Turn it in now)
Homework 2 will appear
this afternoon
1
1/16/2014
Does this DFA have a
minimal number of states?
NO
0
1
1
1
1
0
0
0
Is this mi
1/14/2014
CS 154
Finite Automata vs
Regular Expressions,
Non-Regular Languages
Regular Languages are closed
under all of the following operations:
Union: A B = cfw_ w | w A or w B
Intersection: A B =
1/7/2014
CS 154
Introduction to Automata and
Complexity Theory
http:/stanford.edu/~rrwill/cs154-2014/
cs154.stanford.edu
INSTRUCTORS & TAs
Ryan Williams
Daniel Hollingshead
Michael Kim
1
1/7/2014
Grad