All patterns

Union Find (Disjoint Set)

Near O(1) connected component grouping via Path Compression and Union by Rank

1 standard techniques