🌲 Kruskal's Algorithm — Minimum Spanning Tree
USACO C++ Book · Interactive Visualizer
🌲 Kruskal — Minimum Spanning Tree Full Demo
MST
O(E log E)
Step 0/10
📊 Graph (green = MST edges, red = skipped)
🗂 Data Structures
Sorted Edges (by weight)
DSU Components
MST Total Weight
Time:
O(E log E)
Space:
O(V)
(DSU)
💻 Code
Hint
Click
Next Step ▶
to start and observe how Kruskal selects edges by weight, using DSU to detect cycles.
◀ Prev
Next Step ▶
↺ Reset
0/10
Keyboard:
→
Next
←
Prev
R
Reset