Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Skill

Union-Find & Spanning Trees

Track dynamic connectivity with union-find and build minimum spanning trees with Kruskal's and Prim's algorithms.

Intermediate1 roadmap

3 objectives 6 steps about 115 min

Check what you know

The lessons are coming later. The knowledge check is ready now.

Take the knowledge check

This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.

Learning objectives

  • Implement union-find with path compression and union by size, and explain its near-constant amortized cost per operation.
  • Apply union-find to connectivity problems: counting components as edges arrive, finding a redundant edge, and grouping equivalent items.
  • Compute a minimum spanning tree with Kruskal's algorithm (sort plus union-find) and Prim's algorithm (heap), and justify both with the cut property.

Lesson plan

6 steps, about 115 min · 0 of 5 lessons available so far

  1. Disjoint Sets and Representatives Concept · 15 min · coming later
  2. Lab: Path Compression and Union by Size Lab · 25 min · coming later
  3. Connectivity Questions Answered Online Worked example · 20 min · coming later
  4. The Cut Property and Kruskal's Algorithm Worked example · 25 min · coming later
  5. Prim's Algorithm and When to Prefer It Worked example · 15 min · coming later
  6. Check: Connectivity and MST Problems Knowledge check · 6 questions

Practise it

Implement UnionFind and use it to merge accounts that share an email and to find a redundant connection; then compute the minimum spanning tree of a 5,000-edge cable-layout graph with both Kruskal and Prim and confirm the total weights match.

References

Hard prerequisites

Unlocks

Nothing depends on this skill yet.

On these roadmaps

Progress and evidence for this skill are shared across all of them.