Suppose we changed line 4 of Dijkstra's algorithm to: 4 while el > 1 This change causes the while loop to execute [V] -
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Suppose we changed line 4 of Dijkstra's algorithm to: 4 while el > 1 This change causes the while loop to execute [V] -
Suppose we changed line 4 of Dijkstra's algorithm to: 4 while el > 1 This change causes the while loop to execute [V] - 1 times. Assuming a simple graph with no negative weight edges, will the distances to every vertex be correct when this modified algorithm finishes? DIJKSTRA (G, W,s) 1 INITIALIZE-SINGLE-SOURCE (G, S) 2 S= 3 Q = G.V 4 while 9 70 5 u = EXTRACT-MIN(Q) 6 S= SU{u} 7 for each vertex v € G. Adj 8 RELAX(u, v, w) True False
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!