On this page:
1 Big-O Practice
2 Guessing Combination Locks
3 NFA->DFA Running Time
4 Decidable vs Poly Time

Homework 11

Last updated: Sun, 30 Apr 2023 18:56:59 -0400

Out: Mon May 01, 00:00 EST Due: Sun May 07, 23:59 EST

This assignment begins to explore time complexity.

Homework Problems

  1. Big-O Practice (12 points)

  2. Guessing Combination Locks (12 points)

  3. NFA->DFA Running Time (12 points)

  4. Decidable vs Poly Time (7 + 6 = 13 points)

  5. README (1 point)

Total: 50 points

Submitting

Submit your solution to this assignment in Gradescope hw11. Please assign each page to the correct problem and make sure your solutions are legible.

A submission must also include a README containing the required information.

1 Big-O Practice

Answer TRUE or FALSE for each statement below.

For each statement that is TRUE, give a value for c and n_0 that satisfies the inequality in the definition of big-O.

  1. 99 = O(n^2)

  2. n+100 = O(n)

  3. n-100 = O(\log n)

  4. n^{10} = 2^{O(n)}

  5. 10n\log n = O(\log n)

  6. 100^{2n} = 2^{O(n)}

2 Guessing Combination Locks

  1. Imagine you are on vacation and you forgot the combination to the 4-digit combination lock (like in the picture above) for your luggage. Give a brute force algorithm for figuring out the combination of this 4-digit lock (each digit is 0-9) and give the worst case number of steps. Explain, however, why this problem is in \textbf{P}.

  2. Now imagine the brute-force algorithm from above is generalized to arbitrary locks with n digits. Explain the worst case run time of this algorithm in terms of n and explain why it is no longer in \textbf{P}.

  3. Finally, assume that when trying to open an n digit lock, after each guess, you have a way of knowing whether the guess is "too high" or "too low". Give an algorithm that, using this new knowledge after each guess, runs in at most polynomial time.

3 NFA->DFA Running Time

When learning about regular languages, we defined an algorithm \texttt{NFA}\!\!\rightarrow\!\!\texttt{DFA} (the same procedure is described in Sipser Theorem 1.39) to convert an NFA, e.g., N = (Q_N,\Sigma,\delta_N,q_N,F_N), to an equivalent DFA, e.g., D = (Q_D,\Sigma,\delta_D,q_D,F_D), and we used this procedure in the deciders of several languages.

Compute the running time of this \texttt{NFA}\!\!\rightarrow\!\!\texttt{DFA} algorithm. (You may use the simpler version that assumes that N has no \varepsilon transitions.) Express your answer using big-O notation in terms a variable n = |Q_N| representing the number of states in the NFA. Is this a polynomial time algorithm?

Structure your solution according to the components of the NFA. In other words, your solution should say how many steps it takes to compute Q_D from Q_N, how many steps it takes to compute \delta_D from \delta_N, etc., and then add them all together. As another hint, to calculate this runtime, you want to be thinking about the size of each of the computed DFA parts, in comparison to their NFA counterparts.

4 Decidable vs Poly Time

  1. Show how a decider M_1 for a language L_1 can be used to create a decider for the language L_1^\prime=\left\{s_1\ldots s_m\mid m\geq 0, s_i\in L_1\textrm{ for }0\leq i\leq m\right\}. Remember that deciders must have termination arguments.

  2. Show how a poly time decider M_2 for a language L_2 can be used to create a poly time decider for the language L_2^\prime=\left\{s_1\ldots s_m\mid m\geq 0, s_i\in L_2\textrm{ for }0\leq i\leq m\right\}. Remember that poly time deciders need an explanation of their worst case time complexity, which should be O(n^k) for some constant k\geq 0.