Question
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
0 0
Add a comment Improve this question Transcribed image text
Answer #1

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)

Add a comment
Know the answer?
Add Answer to:
please solve and I will rate! 4. a) Define the concept of NP-Completeness B) Show that...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 4. a) Define the concept of NP-Completeness B) Show that there is a polynomial time algorithm...

    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.

  • please answer and I will rate! 4. a) Define the concept of NP-completeness b) If A...

    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:

  • 4. a) Define the concept of NP-completeness b) If A is NP-complete, and A has a...

    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...

    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...

    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...

    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...

  • Exercise 1 Define a language L to be co-NP-complete if it is in co-NP and a languages in co-NP ca...

    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...

  • Question 4 (4 marks). a. Consider the decision problems PROBLEMA and PROBLEMB. PROBLEMA is known to...

    Question 4 (4 marks). a. Consider the decision problems PROBLEMA and PROBLEMB. PROBLEMA is known to be NP- Complete Your friend has found a polynomial time reduction from PROBLEMB to PROBLEMA. Another friend of yours has found an algorithm to solve any instance of PROBLEMB in polynomial time Have your friends proved that P=NP? Explain your answer. [2 marks b. Consider the following algorithm, which computes the value of the nth triangle number. function TRIANGLENUMBER(n) result 0 for i in...

  • please solve the question , and i will rate simple question pre-calculus An improvement of the...

    please solve the question , and i will rate simple question pre-calculus An improvement of the nearest-neighbor algorithm goes as follows. Apply the nearest-neighbor algorithm once for each vertex by starting the algorithm at that vertex. Take the best of these routes. Apply the improved nearest-neighbor algorithm to the graph below to find an approximate solution of the traveling salesman problem. (Select all that apply.) А 4 5 4. B E 3 D 4 BCAEDB CABEDC ACBEDA DCABED EBCADE Report...

  • please answer one of the two 1. (25) [Single-source shortest-path: algorithm tracing] Show the tracing of...

    please answer one of the two 1. (25) [Single-source shortest-path: algorithm tracing] Show the tracing of Dijkstra's shortest path search algorithm on the weighted directed graph shown below. Do the tracing it twice, first starting with the nodes and, second, starting with the node z. For each tracing, each time the shortest path to a new node is determined, show the graph with the shortest path to the node clearly marked and show inside the node the shortest distance to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT