Union-Find Visualizer

Disjoint Set Forest — BBobop Tool #1837

Configuration

Speed 5

Operations

Presets

Statistics

10
Components
0
Max Height
0
Unions
0
Finds

Operation Log

About Union-Find

Time Complexity: With both union by rank and path compression, each operation runs in amortized O(α(n)) time, where α is the inverse Ackermann function — effectively constant for all practical inputs (grows incredibly slowly; α(2^65536) = 4).

Why Both Optimizations: Union by rank keeps trees shallow (height ≤ log n). Path compression flattens paths during Find, making future queries faster. Together they achieve the theoretical optimum for disjoint set operations.

Applications: Kruskal's MST algorithm, detecting cycles in graphs, connected components, network connectivity, image segmentation, equivalence classes, and percolation theory.