Final Cheetsheet
Final Cheetsheet
1. Initialize:
o Start with an arbitrary vertex as part of the MST.
o Maintain two sets:
MST Set: Vertices included in the MST.
Non-MST Set: Vertices not yet included.
o Keep a priority queue (or another data structure) to track the minimum edge connecting
MST and Non-MST sets.
2. Iterative Process:
o Select the edge with the smallest weight that connects a vertex in the MST set to a
vertex in the Non-MST set.
o Add this edge and the corresponding vertex to the MST set.
o Update the priority queue with edges originating from the newly added vertex.
3. Repeat until all vertices are included in the MST.
4. Result:
o The MST is complete when all vertices are in the MST set.
o The sum of the selected edge weights gives the total weight of the MST.