Intro to Union-Find Data Structure

Union-Find is a data structure that mimics tree data structure except that nodes point to their parent instead of children. The union-find is very useful for set operations such as the following.1. find – find the root of the current node2. same component – check if two trees have the same root node. (belongs to the same set)3. union (merge) – merge two trees (sets) into one Such operations are very useful for problems like connected components – each node belongs to only one connected component – and vertex coloring. The union-find is useful for algorithms such as minimum-spanning tree READ MORE