Skip to main content
HS
HiSETSuccess
LeetCode Prep

Algorithm Visualizer

Step through two pointers, sliding window, binary search, BFS/DFS, heaps, DP, and union-find one operation at a time.

← All visualizers

Union-Find with Path Compression

Merge components by rank and flatten find paths so connectivity queries become nearly O(1).

≈ O(α(n)) per operation

2–10 nodes, then | and up to 12 edges like 0-1.

Presets
01234567
node01234567
parent01234567
rank00000000
Edges left0–12–31–34–55–66–74–73–7

1/358 nodes, each its own component. Process the edges one by one.

Keyboard: ← → step · Space play/pause