Union-Find
Union-Find is a data structure that efficiently manages a partition of a set into disjoint subsets. It supports two primary operations: Union, which merges two subsets, and Find, which identifies the subset containing a particular element. This structure is particularly useful in scenarios like network connectivity and clustering.
The Union-Find algorithm employs techniques like path compression and union by rank to optimize these operations. Path compression flattens the structure of the tree whenever Find is called, while union by rank ensures that smaller trees are always added under larger trees, maintaining efficiency in operations over time.