Section 7.1

Exercises

[12/100%]
Show
LaTeX
Problem 7.1

Answer each part TRUE or FALSE.

?
(a)

2n=O(n)2 n=O(n).

(b)

n2=O(n)n^{2}=O(n).

(c)

ᴬ n2=O(nlog⁡2n)n^{2}=O\left(n \log^{2} n\right).

(d)

ᴬ nlog⁡n=O(n2)n \log n=O\left(n^{2}\right).

(e)

3n=2O(n)3^{n}=2^{O(n)}.

(f)

22n=O(22n)2^{2^{n}}=O\left(2^{2^{n}}\right).

Problem 7.2

Answer each part TRUE or FALSE.

?
(a)

n=o(2n)n=o(2 n).

(b)

2n=o(n2)2 n=o\left(n^{2}\right).

(c)

ᴬ 2n=o(3n)2^{n}=o\left(3^{n}\right).

(d)

ᴬ 1=o(n)1=o(n).

(e)

n=o(log⁡n)n=o(\log n).

(f)

1=o(1/n)1=o(1 / n).

Problem 7.3

Which of the following pairs of numbers are relatively prime? Show the calculations that led to your conclusions.

?
(a)

1274 and 10505

(b)

7289 and 8029

Problem 7.4

Fill out the table described in the polynomial time algorithm for context-free language recognition from Theorem 7.16 for string w=w= baba and CFG GG :

S→RTR→TR∣aT→TR∣b \begin{aligned} & S \rightarrow R T \\ & R \rightarrow T R \mid \mathrm{a} \\ & T \rightarrow T R \mid \mathrm{b} \end{aligned}
?
Problem 7.5

Is the following formula satisfiable?

(x∨y)∧(x∨yˉ)∧(xˉ∨y)∧(xˉ∨yˉ) (x \vee y) \wedge (x \vee \bar{y}) \wedge (\bar{x} \vee y) \wedge (\bar{x} \vee \bar{y})
?
Problem 7.6

Show that P is closed under union, concatenation, and complement.

?
Problem 7.7

Show that NP is closed under union and concatenation.

?
Problem 7.8

Let CONNECTED⁡={⟨G⟩∣G is a connected undirected graph }\operatorname {CONNECTED}=\left\{ \langle G\rangle \mid G\text{ is a connected undirected graph }\right\}. Analyze the algorithm given on page 185 to show that this language is in P.

?
Problem 7.9

A triangle in an undirected graph is a 3-clique. Show that TRIANGLE ∈P\in \mathrm{P}, where TRIANGLE ={⟨G⟩∣G contains a triangle }=\left\{ \langle G\rangle \mid G\text{ contains a triangle }\right\}.

?
Problem 7.10

Show that ALL⁡DFA \operatorname {ALL}_{\text{DFA }} is in P.

?
Problem 7.11

In both parts, provide an analysis of the time complexity of your algorithm.

?
(a)

Show that EQ⁡DFA∈P\operatorname {EQ}_{\mathrm{DFA}} \in \mathrm{P}.

(b)

Say that a language AA is star-closed if A=A∗A=A^{*}. Give a polynomial time algorithm to test whether a DFA recognizes a star-closed language. (Note that EQ⁡NFA \operatorname {EQ}_{\text{NFA }} is not known to be in P.)

Problem 7.12

Call graphs GG and HH isomorphic if the nodes of GG may be reordered so that it is identical to HH. Let ISO⁡={⟨G,H⟩∣G and H are isomorphic graphs}\operatorname {ISO}=\left\{ \langle G, H\rangle \mid G\text{ and }H\text{ are isomorphic graphs}\right\}. Show that ISO⁡∈NP\operatorname {ISO} \in \mathrm{NP}.

?