a. A decision problem L is NP-complete if:
1) L is in NP (Any given solution for NP-complete
problems can be verified quickly, but there is no efficient known
solution).
2) Every problem in NP is reducible to L in
polynomial time (Reduction is defined below).
A problem is NP-Hard if it follows property 2 mentioned above, doesn’t need to follow property 1. Therefore, NP-Complete set is also a subset of NP-Hard set.
b.
The longest path problem for a general graph is not as easy as the shortest path problem because the longest path problem doesn’t have optimal substructure property. In fact, the Longest Path problem is NP-Hard for a general graph. However, the longest path problem has a linear time solution for directed acyclic graphs. The idea is similar to linear time solution for shortest path in a directed acyclic graph., we use Topological Sorting.
We initialize distances to all vertices as minus infinite and distance to source as 0, then we find a topological sorting of the graph. Topological Sorting of a graph represents a linear ordering of the graph Once we have topological order (or linear representation), we one by one process all vertices in topological order. For every vertex being processed, we update distances of its adjacent using distance of current vertex.
Following is complete algorithm for finding longest
distances.
1) Initialize dist[] = {NINF, NINF, ….} and
dist[s] = 0 where s is the source vertex. Here NINF means negative
infinite.
2) Create a toplogical order of all
vertices.
3) Do following for every vertex u in topological
order.
………..Do following for every adjacent vertex v of u
………………if (dist[v] < dist[u] + weight(u, v))
………………………dist[v] = dist[u] + weight(u, v)
4. a) Define the concept of NP-Completeness B) Show that there is a polynomial time algorithm...
please solve and I will rate! 4. a) Define the concept of NP-Completeness B) Show that there is a polynomial time algorithm that finds a longest path in a directed graph, under the condition that A is NP-complete and A has a polynomial time algorithm.
4. a) Define the concept of NP-completeness b) If A is NP-complete, and A has a polynomial time algorithm, then show that there is a polynomial time algorithm to find a longest path in a directed graph.
4. a) Define the concept of NP-completeness b) If A is NP-complete, and A has a polynomial time algorithm, then a polynomial time algorithm to find a longest path in a directed graph.
4. a) Define the concept of NP-completeness b) If A is NP-complete, and A has a polynomial time algorithm, then a polynomial time algorithm to find a longest path in a directed graph. Answer:
please answer and I will rate! 4. a) Define the concept of NP-completeness b) If A is NP-complete, and A has a polynomial time algorithm, then a polynomial time algorithm to find a longest path in a directed graph. Answer:
2. Prove that {a"6"c" |m,n0}is not a regular language. Answer: 3. Let L = { M M is a Turing machine and L(M) is empty), where L(M) is the language accepted by M. Prove L is undecidable by finding a reduction from Aty to it, where Arm {<M.w>M is a Turing machine and M accepts Answer: 4. a) Define the concept of NP-completeness b) If A is NP-complete, and A has a polynomial time algorithm, then a polynomial time algorithm...
2. Describe why finding a polynomial-time algorithm for a NP-complete problem would answer the question if P = NP. What would the answer be? (7-10 sentences minimum)
(complexity) prove: if P=NP, then there's an algorithm with a polynomial running time for the following problem: input: a boolean formula φ output: a satisfying assignment of φ if φ satisfiable. if φ not satisfiable, a "no" will be returned. explanation: the algorithm accepts φ as an input (boolean formula). if φ doesn't have a satisfiable assignment, a "no" is returned. if φ does have a satisfiable assignment, one of the satisfying assignment is returned,. so we assign 0 or...
(Q4 - 30 pts: 15, 15) a) Give an O (n) time algorithm for finding the longest (simple) path in a tree on n vertices. Prove the correctness of your algorithm. Give a polynomial time algorithm for finding the longest (simple) path in a graph whose blocks have size bounded by a constant. Prove the correctness of your algorithm. b)
Hi, this question is from Theory of Computation. Kindly help if you can. Exercise 1 Define a language L to be co-NP-complete if it is in co-NP and a languages in co-NP can be polynomial-time reduced to L. Say that a formula of quantified boolean logic is a universal sentence if it is a sentence (i.e., has no free variables) of the form Vai... Vxn(V) where> is a propositional logic formula (contains no quantifiers). Show that the language to I...