

























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!


























Time Complexity
Example: (^) L { a b : n 0 } n n Algorithm to accept a string w :
For string of length time needed for acceptance: L { a b : n 0 } n n n O ( n )
Language class: DTIME ( n ) A Deterministic Turing Machine accepts each string of length in time DTIME ( n ) 1
2
3
O ( n ) n
In a similar way we define the class DTIME ( T ( n )) for any time function: T ( n^ ) Examples: (^ ), ( ),... 2 3 DTIME n DTIME n
Example: The membership problem for context free languages L { w : w is generated by grammar G } ( ) 3 L DTIME n (CYK - algorithm) Polynomial time
Polynomial time algorithms: ( ) k DTIME n Represent tractable algorithms: For small we can compute the result fast k
k P DTIME n for all k
Exponential time algorithms: ( 2 ) n DTIME Represent intractable algorithms: Some problem instances may take centuries to solve
14 Example: the Hamiltonian Problem Question: is there a Hamiltonian path from s to t? s t
n L DTIME n DTIME Exponential time Intractable problem A solution: search exhaustively all paths L = {<G,s,t>: there is a Hamiltonian path in G from s to t}
Example: The Satisfiability Problem Boolean expressions in Conjunctive Normal Form: k t t t t 1 2 3 i p t x x x x 1 2 3 Variables Question: is expression satisfiable?
1 2 1 2 ( x x ) x x Not satisfiable Example:
L { w :expression w is satisfiabl e} ( 2 ) n For n variables: L DTIME Algorithm: search exhaustively all the possible binary values of the variables exponential