















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
















































































1
2
Running time
Time complexity classes The class P Converting RAM programs to TM programs with polynomial loss of efficiency Decision problems encoding I/O problems Factoring numbers Context free languages are in P CYK algorithm
4
Q: What the running time of the above?
0
1
rej acc
2
5
A: Assuming S = {0,1}, the running time is
T (n)=n+1` as can be seen on any input starting with 1. Even though the TM runs faster on 0{0,1}*, running time is defined in terms of the worst case. Crashes don’t affect this.
0
1
rej acc
2
7
As opposed to the standard Church-Turing
thesis for which there is overwhelming evidence, there is a great deal of current research trying to show that the strong version is false. In particular:
Possible Counterexample: Many conjecture
that no polynomial time algorithm exists for factoring numbers using a TM. But a polynomial time quantum algorithm exists (Peter Shor). Would mean that quantum computers invalidate Strong C-T thesis!
8
Big-O Notation
Nothing to say here.
Assume you learned in Discrete Math and
Data Structures.
10
Big- says that both functions dominate each- other so are asymptotically equivalent. I.e.
f (x ) = O (g (x )) f (x ) = (g (x ))
11
Any polynomial is big- of its largest
term
The sum of two functions is big- O of
the biggest
Non-zero constants are irrelevent:
13
Big-O, Big-, Big-.
, (change of base formula)
1 x
13 1 x lg 2 x x sin x , x x , 13 x
14
Time complexity classes are the next
languages classes that we’ll study:
DEF: Suppose that g (n) is a real function.
The time complexity class TIME(g (n) ) consists of all languages which are decided by some TM with running time O(g (n)). Any such language is said to by of time complexity g (n).
16
A: ALL! This particular decider for the
language has running time f (n) = n+ which is big-O of no.’s 1, 2 and 3. But the definition doesn’t say that must stick to any single implementation:
Q: How would you modify the TM to see
that accepted language is in TIME(1)?
0
1
rej acc
2
17
A: Accepted language is 10{0,1}*. So
just need to check first two bits as pictured below:
So now we see that the language is
accepted by a TM which runs in constant time.
0 1 2 acc
19
time can be simulated by a multi-tape TM which
time can be simulated by a one-tape TM which
time can be simulated by a one-tape TM which
Consequently, any algorithm that runs in polynomial time on your desktop, can be made to run in polynomial time on a TM.
20
No proofs. Rather, give brief explanation:
A RAM consists of a “goto” style program and a memory made up of arbitrarily many integers called registers and each having an integer address. A single step of a RAM consists of doing
keep these contents on one of the TM tapes, changing the state of the simulated RAM requires