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

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.

Step by Step Solution

3.47 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The algorithm is not ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

954-M-L-A-L-S (8357).docx

120 KBs Word File

Students Have Also Explored These Related Linear Algebra Questions!