You are to implement Kursakal\'s algorithm. Which data structures and algorithms
ID: 3635033 • Letter: Y
Question
You are to implement Kursakal's algorithm. Which data structures and algorithms you would use and why those rather than some alternative. Be sure to specify the contents of any required record types.Kursakal's Minimum Cost Spanning Tree Algorithm:
(a) create a forest F (a set of trees), where each vertex in the graph is a separate tree.
(b) create a set S containing all the edges in the graph.
(c) while S is nonempty and F is not yet spanning
- remove an edge with minimum weight from S
- if that edge connects two dierent trees, then add it to the forest, combining two trees into a single tree
- otherwise discard that edge.
At the termination of the algorithm, the forest has only one component and forms a minimum spanning tree of the graph.