For her class in the analysis of algorithms, Stacy writes the following algorithm to determine the shortest

Question:

For her class in the analysis of algorithms, Stacy writes the following algorithm to determine the shortest distance from a vertex a to a vertex b in a weighted directed graph G = (V, E).
Step 1 : Set Distance equal to 0, assign vertex a to the variable v, and let T = V.
Step 2: If v = b, the value of Distance is the answer to the problem. If v ≠ b, then
(1) Replace T by T - {u} and select w e T withwt(u, w) minimal.
(2) Set Distance equal to Distance + wt(u, w).
(3) Assign vertex w to the variable v and then return to step (2).
Is Stacy's algorithm correct? If so, prove it. If not, provide a counterexample.
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: