TDDD65 Homework 2 – 2015

advertisement
2015-10-04
Linköpings Tekniska Högskola
Institutionen för Datavetenskap
Christer Bäckström
TDDD65 Homework 2 – 2015
Deadline: Tuesday 2015-10-13 kl. 17
You can put the solutions in the plastic holder outside my room (B 3B:461C).
You must also be present at the session on wednesday 2015-10-14 for oral presentations.
1. Prove or disprove the following statement: If a language A is mapping reducible to a contextfree language, then A is context-free.
2. Consider the following functions, where k ≥ 4 is a constant, and log is the logarithm of
base 2.
√
k n+1 , nlog k , n log n, nk , n3 , k n , nk+1 , k k
Order them according to their growth rate, i.e., put them in the sequence f1 , . . . , f8 such
that fi = O(fi+1 ) for i = 1, . . . , 7.
3. Give an implementation level description of a deterministic Turing machine that decides
2
the language {0n 1n | n ≥ 0}. For the intended meaning of “implementation level”, see, for
instance, Examples 3.11 and 3.12 in Sipser).
4. Let A, B and C be languages.
(a) Suppose A is decidable, B is undecidable and that A ≤m C and
B ≤m C. Can C be decidable?
(b) Suppose A is decidable, B is undecidable and that A ≤m B and
A ≤m C. Can C be decidable?
(c) Suppose A and C are undecidable, and that A ≤m B and B ≤m C. Can B be decidable?
5. For each of the following 3 problems, prove that the problem is in NP or explain why this
cannot be proven (with our current knowledge).
(a) AndSat
Input: Two 3CNF formulae φ and ψ.
Question: Are both φ and ψ satisfiable?
(b) OrSat
Input: Two 3CNF formulae φ and ψ.
Question: Is at least one of φ and ψ satisfiable?
(c) XorSat
Input: Two 3CNF formulae φ and ψ.
Question: Is exactly one of φ and ψ satisfiable?
1
6. We say that a map is properly colored if no neighbouring countries have the same color.
Consider the following algorithm for checking that a map can be properly colored using at
most 4 colors:
For each coloring of the map check whether it is a proper coloring by for each country
checking that its color differs from the colors of its neighbours.
Denote by T (n) the worst-case running time of the algorithm, where n is the number of
countries. Analyze T (n) and express the worst case complexity in big-O notation.
2
Download