Module M28 · 27 of 35 in teaching order · Intermediate

Union Find

Disjoint sets with union by rank and path compression, and their near-constant amortized cost.

Lessons

  1. Union-find as a forest of parent pointers: find, union and connected, union by rank, path compression, and why m operations cost O(m α(n)).

Topics this module covers

The full module scope. Topics without a lesson above are not written yet.

  • find/union
  • rank/size
  • path compression
  • amortized bounds
  • dynamic connectivity
  • implementation

Builds toward