YUNOVA · Data Structures & Algorithms · Module 12: Advanced graphs

Minimum spanning tree: Prim and Kruskal

Notes for offline study · 3 November 2026

Minimum spanning tree: Prim and Kruskal

Key points

  • A minimum spanning tree connects all vertices with least total edge weight.
  • Kruskal sorts edges and adds each one that does not form a cycle, using DSU.
  • Prim grows the tree from one vertex using a priority queue.