Hard

Kruskal's Algorithm

Kruskal sorts edges by weight and adds an edge when it joins two different components. A union-find structure rejects edges that would close a cycle.

Costs

CategoryAlgorithm
DifficultyHard
TimeO(E log E)
Resulta minimum spanning tree, or forest
Needsan undirected weighted graph

Questions

What is Kruskal's Algorithm?

Kruskal sorts edges by weight and adds an edge when it joins two different components. A union-find structure rejects edges that would close a cycle.

Where do I practice it?

DSA Master keeps challenges and progress on the phone. This page is the idea and the costs.