All challenges
advancedData Structures & Algorithms~60 min

Minimum Spanning Tree

Design least-cost networks by building a Minimum Spanning Tree. You will implement a Union-Find (disjoint set) structure, then Kruskal's and Prim's algorithms, and finally use the MST to test whether a graph is connected. Graphs are undirected with integer nodes 0..n-1 and edges given as (u, v, weight).