TUTORIAL 9
EXERCISE 1 (COMPULSORY)
Which of these deο¬nitions of the O-notation are correct?
1.
1.
2.
3.
f = O(g) iff, there exist positive integers c and n0 such that for all n ≥ n0 we have that f(n) ≥ c * g(n)
f = O(g) iff, for all positive integers c and n0 it is the case that for all n ≥ n0 we have that f(n) ≤ c * g(n)
f = O(g) iff, there exist positive integers c and n0 such that for all n ≥ n0 we have that f(n) ≤ c * g(n)
a. This is the correct, since there should EXIST a positive c and n0
4. f = O(g) iff, for all positive integers c and n0 it is the case that there exists an n ≥ n0 such that f(n) ≤ c * g(n)
EXERCISE 2 (COMPULSORY)
Which of the following claims are true? Give precise arguments (proofs) for your answers.
1.
2.
3.
4.
5.
6.
3π2 + 2π + 7 = π(π2 )
a. This is true for some positive integer c since π2 will always grow faster than n
2
π = π(π log π)
a. This is not true since π2 is growing a lot faster than π log π and will therefore dominate at some
point
3π = 2π(π) (hint: 3 = 2log2 3 )
a. True, since 2π(π) means an upper bound π(2ππ ) for some constant c
2
π = π(π3 )
a. True, since it is the asymptotic upper bound
π2 = π(π2 )
a. False, since π2 will never be an asymptotic upper bound, but always equal
π = π(2π)
a. True, since 2 n’s will always be bigger than 1
EXERCISE 3 (COMPULSORY)
Assume a 5-tape Turing machine M running in timeπ(π3 ). What is the time complexity of the corresponding singletape Turing machine simulating M.
Let π‘(π) be a function where π‘(π) ≥ π then every π‘(π) time multitape Turing machine has an equivalent π(π‘ 2 (π))
time single-tape Turing machine.
The time complexity of the corresponding single-tape Turing machine is π(π‘ 2 (π3 )).
EXERCISE 4 (COMPULSORY)
Which of the following statements about the class P are correct?
1.
2.
3.
4.
5.
P is the class of all languages that are decidable by deterministic single-tape Turing machines running in
polynomial time.
a. True
P is the class of all languages such that if π€ ∈ π then there is a deterministic single-tape Turing machine
which accepts the string w in polynomial time.
a. (True) depends if w belongs to P is true
P is the class of all languages that are decidable by deterministic multi-tape Turing machines running in
polynomial time.
a. True
A language L belongs to P iff there is a constant k and a decider M running in time π(ππ ) such that πΏ = πΏ(π).
a. True
A language L belongs to P iff πΏ ∈ ππΌππΈ(2π ).
a. False, since 2π is not polynomial time, lolzz
Give 5 languages that are in the class P. Does π΄ ππ belong to P?
π΄ ππ does not belong to P since π΄ ππ is undecidable
1.
2.
3.
4.
5.
πΏ1 = {0π 1π | π ≥ 0}
ππ΄ππ» = {〈πΊ, π , π‘〉| πΊ is a graph with a path from node s to t}
πΈππΈπ = {π | π is an even number}
πΈπππ΄πΏ = {π€#π€ |π€ is {0,1}∗ }
π
πΈπΏππ
πΌππΈ = {〈π₯, π¦〉|π₯ and π¦ are relatively prime} (RELPRIME = RELatively PRIME).
EXERCISE 5 (COMPULSORY)
Deο¬ne the language π΄πΏπΏπ·πΉπ΄ and show that π΄πΏπΏπ·πΉπ΄ ∈ π
π΄πΏπΏπ·πΉπ΄ = {〈π·〉| π· is a DFA and πΏ(π·) = Σ ∗ }
M is a decider for π΄πΏπΏπ·πΉπ΄
M = “On input D:
1.
2.
3.
If the start state is not an accept state, reject. Else, mark it
O(1)
While there are still unmarked states connected to a marked state
O(n)
1. Go through all states connected to a marked state.
O(n)
1. If the state is not an accept state, reject. Else, mark it O(1)
Accept”
O(1)
π(1 + π ∗ π ∗ 1 + 1) = π(π2 )
π΄πΏπΏπ·πΉπ΄ = O(π2 )
π΄πΏπΏπ·πΉπ΄ ∈ π