For her class in the analysis of algorithms, Stacy writes the following algorithm to determine the shortest
Question:
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:
Related Book For
Discrete and Combinatorial Mathematics An Applied Introduction
ISBN: 978-0201726343
5th edition
Authors: Ralph P. Grimaldi
Question Posted: