This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: c. Suppose the shortest path from s to t is S > u1 > u2 > u3 > t Suppose we do a long sequence of update operations that include (s1, u1) , ut, t) In that order, then dist[t] will be correctly set. What sequence of updates is guaranteed to have this property? Ans: update every edge V 1 times. d. Procedure BellmanFord(G, l, s) For all u in V Dist[u] = inf Dist[s] = 0 Repeat V 1 times: For all c in E Update Procedure update (u, w) If dist[w] > dist[u] + l(u, w) Dist[w] = dist[u] + l(u, w) Time: O(V * E) slower than dijkstras S A B C D E 0 inf inf inf inf inf 0 10 inf inf 4 2 0 10 6 10 3 2 0 5 6 10 3 2 5 1 9 3 2 4 1 9 3 2 e....
View
Full
Document
This note was uploaded on 01/09/2012 for the course CSE 101 taught by Professor Staff during the Spring '08 term at UCSD.
 Spring '08
 staff
 Algorithms

Click to edit the document details