Kruskal & Union Find

Go to:
> Material
> Lecture Recap


Material


Lecture Recap

This week we concluded our discussion on Minimum Spanning Trees with Kruskal’s Algorithm and the Union-Find data structure. This is also the algorithm I would recommend you to code up if it comes up in the exam (you can find a Java implementation of the Union-Find in the slides).

Kruskal’s Algorithm

Kruskal sorts all edges by weight and greedily adds them to the MST, skipping only those that would create a cycle.

Union-Find Data Structure

To speed up Kruskal’s, we use Union-Find to manage connected components.