0Pricing
Competitive Programming Academy · Lesson

Kruskal's Minimum Spanning Tree

Add cheapest edges without cycles.

What an MST Is

A minimum spanning tree connects every vertex using the cheapest total edge weight, with no cycles. Think wiring a town for the least cost. 🌲

Kruskal's Core Idea

Kruskal's algorithm is pure greed: keep adding the cheapest edge that does not create a cycle until the whole graph is joined.

All lessons in this course

  1. DSU with Path Compression
  2. Union by Rank and Components
  3. Kruskal's Minimum Spanning Tree
  4. Prim's MST with a Heap
← Back to Competitive Programming Academy