Prim algorithm and Dijkstra algorithm are similar: both are greedy algorithms, but a bit different.
Using the following diagram and pseudocode:
i) Explain briefly how they differ using a few calculations and your own words. Modify the red part in the following Prim algorithm's pseudocode so that it can be transformed into a Dijkstra algorithm.
ii) Notes:
i. You don't need to show all calculations, just show only a small necessary part of the calculation to demonstrate how Prim and Dijkstra algorithms differ.
ii. You must use the following diagram & pseudocode.
3
L
2
3
2
2
Diagram 1