Skip to content

Tag Archives: union-find

Prerequisite : LCA basics, Disjoint Set Union by Rank and Path CompressionWe are given a tree(can be extended to a DAG) and we have many… Read More
Given an undirected, connected and weighted graph, find Minimum Spanning Tree (MST) of the graph using Kruskal’s algorithm. Input : Graph as an array of… Read More
Given an undirected graph, how to check if there is a cycle in the graph?  Example,  Input: n = 4, e = 4  Output: Yes … Read More
In the previous post, we introduced union find algorithm and used it to detect cycle in a graph. We used following union() and find() operations… Read More
A disjoint-set data structure is a data structure that keeps track of a set of elements partitioned into a number of disjoint (non-overlapping) subsets. A… Read More

Start Your Coding Journey Now!