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!
Theorem (Linear Speed-Up) For any TM T that decides a language L, and any m > 0 there is another TM T ′^ that also decides L, such that
TimeT ′ (x) ≤ Time mT (x)+ 2 |x|.
Theorem (Table Look-Up) For any TM T that decides a language L, and any m > 0 there is another TM T ′^ that also decides L, such that for all inputs x with |x| ≤ m, TimeT (x) = |x|.
Definition A function f (n) is said to be O(g(n)) if and only if there are positive constants, c and n 0 such that f (n) ≤ c · g(n) for all n > n 0.
Intuition: f grows not faster than g.
1 3 n + 7 is O(n)? 2 n is O( 3 n + 7 )? 3 n^2 + n is O(n^2 )? 4 n^2 is O(n^2 + n)? 5 n is O( 0. 1 n^2 )? 6 0. 1 n^2 is O(n)? 7 log n is O(n)? 8 n is O(log n)? 9 nk^ is O( 2 n)? 10 2 n^ is O(nk^ )?
1 3 n + 7 is O(n)? YES 2 n is O( 3 n + 7 )? YES 3 n^2 + n is O(n^2 )? 4 n^2 is O(n^2 + n)? 5 n is O( 0. 1 n^2 )? 6 0. 1 n^2 is O(n)? 7 log n is O(n)? 8 n is O(log n)? 9 nk^ is O( 2 n)? 10 2 n^ is O(nk^ )?
1 3 n + 7 is O(n)? YES 2 n is O( 3 n + 7 )? YES 3 n^2 + n is O(n^2 )? YES 4 n^2 is O(n^2 + n)? 5 n is O( 0. 1 n^2 )? 6 0. 1 n^2 is O(n)? 7 log n is O(n)? 8 n is O(log n)? 9 nk^ is O( 2 n)? 10 2 n^ is O(nk^ )?
1 3 n + 7 is O(n)? YES 2 n is O( 3 n + 7 )? YES 3 n^2 + n is O(n^2 )? YES 4 n^2 is O(n^2 + n)? YES 5 n is O( 0. 1 n^2 )? YES 6 0. 1 n^2 is O(n)? 7 log n is O(n)? 8 n is O(log n)? 9 nk^ is O( 2 n)? 10 2 n^ is O(nk^ )?
1 3 n + 7 is O(n)? YES 2 n is O( 3 n + 7 )? YES 3 n^2 + n is O(n^2 )? YES 4 n^2 is O(n^2 + n)? YES 5 n is O( 0. 1 n^2 )? YES 6 0. 1 n^2 is O(n)? NO 7 log n is O(n)? 8 n is O(log n)? 9 nk^ is O( 2 n)? 10 2 n^ is O(nk^ )?
1 3 n + 7 is O(n)? YES 2 n is O( 3 n + 7 )? YES 3 n^2 + n is O(n^2 )? YES 4 n^2 is O(n^2 + n)? YES 5 n is O( 0. 1 n^2 )? YES 6 0. 1 n^2 is O(n)? NO 7 log n is O(n)? YES 8 n is O(log n)? NO 9 nk^ is O( 2 n)? 10 2 n^ is O(nk^ )?
1 3 n + 7 is O(n)? YES 2 n is O( 3 n + 7 )? YES 3 n^2 + n is O(n^2 )? YES 4 n^2 is O(n^2 + n)? YES 5 n is O( 0. 1 n^2 )? YES 6 0. 1 n^2 is O(n)? NO 7 log n is O(n)? YES 8 n is O(log n)? NO 9 nk^ is O( 2 n)? YES 10 2 n^ is O(nk^ )?
1 3 n + 7 is O(n)? YES 2 n is O( 3 n + 7 )? YES 3 n^2 + n is O(n^2 )? YES 4 n^2 is O(n^2 + n)? YES 5 n is O( 0. 1 n^2 )? YES 6 0. 1 n^2 is O(n)? NO 7 log n is O(n)? YES 8 n is O(log n)? NO 9 nk^ is O( 2 n)? YES 10 2 n^ is O(nk^ )? NO Question: compare growth rate of log 2 n and log 999 n.
Definition For any function f , we say that the time complexity of a decidable language L is O(f ), or L is decidable in O(f ) time, if there exists a TM T which decides L, and constants n 0 and c such that for all inputs x with |x| > n 0 ,
TimeT (x) ≤ cf (|x|)
Definition
P =
k≥ 0
TIME[nk^ ]
Note: The class P contains all classes TIME[t(n)], where t(n) is a polynomial of finite degree