Formal Languages, Automata and Computability: Read Sections 7.1 - 7.3 of The Book For Next Time
Formal Languages, Automata and Computability: Read Sections 7.1 - 7.3 of The Book For Next Time
FORMAL LANGUAGES,
AUTOMATA AND
COMPUTABILITY
Read sections 7.1 7.3 of the book for next time
TIME COMPLEXITY
OF ALGORITHMS
(Chapter 7 in the textbook)
COMPLEXITY THEORY
Studies what can and cant be computed under
limited resources such as time, space, etc.
Today: Time complexity
ASYMPTOTIC ANALYSIS
5n3 + 2n2 + 22n + 6 = O(n3)
Big-O notation has been discussed
in previous classes. We will briefly
review it.
BIG-O
Let f and g be two functions f, g : N R+.
We say that f(n) = O(g(n)) if positive integers
c and n0 exist so that for every integer n n0
f(n) c g(n)
When f(n) = O(g(n)), we say that g(n) is an
asymptotic upper bound for f(n)
00000000000001111111111111
x0x0x0x0x0x0xx1x1x1x1x1x1x
xxx0xxx0xxx0xxxx1xxx1xxx1x
xxxxxxx0xxxxxxxxxxxx1xxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxx
Theorem.
Let t(n) be a function such that t(n) n.
Then every t(n)-time multi-tape TM has
an equivalent O(t(n)2) single-tape TM.
Polynomial Time
P=
TIME(n )
k
kN
NON-DETERMINISTIC
TURING MACHINES
AND NP
NON-DETERMINISTIC TMs
read
write
0 0, R
move
0 0, R
, R
0 0, R
, R
qreject
qaccept
NON-DETERMINISTIC TMs
are just like standard TMs, except:
1. The machine may proceed according to
several possibilities.
2. The machine accepts a string if there
exists a path from start configuration to an
accepting configuration.
Deterministic
Computation
Non-Deterministic
Computation
reject
accept or reject
accept
: Q Pow(Q {L,R})
q0 Q is the start state
qaccept Q is the accept state
qreject Q is the reject state, and qreject qaccept
Deterministic
Computation
Non-Deterministic
Computation
reject
accept or reject
accept
BOOLEAN FORMULAS
logical
parentheses
operations
A satisfying assignment is a setting of the
variables that makes the formula true.
= (x y) z
BOOLEAN FORMULAS
x = 0, y = 0, z = 1 is a satisfying assignment for:
(x y) (z x)
0
0
1
0
1
a b c d
(x y) x
( 1 y 1 )
( 0 1 0 )
NP =
NTIME(n )
k
kN
P = NP?
POLY-TIME REDUCIBILITY
f : * * is a polynomial-time computable
function if some poly-time Turing machine M, on
every input w, halts with just f(w) on its tape.
Language A is polynomial time reducible to
language B, written A P B, if there is a polytime computable function f : * * such that:
w A f(w) B
f is called a polynomial-time reduction of A to B.
B
f
NP
P
B
SAT, 3-SAT NP
NP
3-SAT