Algorithm代写 – Algorithm

Algorithm

Algorithm代写 – 这是利用Algorithm进行训练的代写, 对Algorithm的流程进行训练解析, 涉及了NP等代写方面

算法代写 代写算法 Algorithm代写 代写Algorithm  算法作业代写

(a) False (b) False The following string 01000 can be generated by this grammar while is not the form of

(c) True The form recurrence is applicable of the Master Theorem

Therefore Since therefore Algorithm B is asymptotically faster (d) False (If P != NP) Counter example: The problem A is a trivial problem that answers yes for every input. Which is not NP-Complete and in P. And Problem B is a Vertex-Cover. We can polynomially reduce an instance of A to B as a graph with only one vertex and no edges. And no matter what a solver of B answers, we answer "yes". (e) False The problem is in P, so not NP-complete with the assumption P != NP. The problem can be solved as to get the total weight of MST of G (for example, Prim’s) and see if the weight. Hence it’s a polynomial time algorithm. (f) False Decidable languages are closed under complement. Decidable languages can not have undecidable complement, and vise versa. (g) False (h) True. Since L is finite, we can enumerate the members of L and see if it equals the input in finite time.( will halt). Therefore L is decidable.

2

(a) 001011011011010 (b) Main Idea Assign 0 edges weight 1, and 1 edges -1, edges 0 and run BF. Algorithm

  1. Build a graph such that:

where

  1. Then we run Bellman-Ford from and see if any is negative (including )
  2. if so, that means we have a walk from s to any accepting state a, and the number of 0’s on it is less than the number of 1’s. Time Build graph: ,run Bellman-Ford = Correctness The states order during the NFA recognition forms a walk from start to any accepting state. If we assign edge weight like said above, then the total weight of a walk will be

=

If this number is less than zero, then it means we have found such a walk. If there is a walk with strictly less number 0’s than 1’s, then it will eventually be found by the Bellman Ford algorithm.

(c) We first derive a DFA out of the NFA M. Then invert the accepting attribute of each state(that is: an accepting state is now not accepting, and vise versa). Then the DFA recognizes the complement of , then we run the same algorithm as in part (b). The time is subset construction.

state inversion. Bellman Ford.