Question: Consider the recursive algorithm in Figure 10.80 for finding the shortest weighted path in an acyclic graph, from s to t. a. Why does this
.png)
a. Why does this algorithm not work for general graphs?
b. Prove that this algorithm terminates for acyclic graphs.
c. What is the worst-case running time of the algorithm?
Distance shortest( s,t ) Distance di, tmp; if( s == t ) return 0; de 00; for each Vertex v adjacent to s { tmp = shortest (v, t ); if( Cs,y + tmp < d) di = Csy + tmp; } return d;; }
Step by Step Solution
3.45 Rating (171 Votes )
There are 3 Steps involved in it
a If the graph has a cycle then the recursion does not alway... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
1486-C-S-A(552).docx
120 KBs Word File
