# Tag Archives: disjoint-set

Disjoint Set is a data structure that keeps track of a set of elements partitioned into a number of disjoint subsets and it is used… Read More
Geek is a chemical scientist who is performing an experiment to find an antidote to a poison. The experiment involves mixing some solutions in a… Read More
A Disjoint set union is an algorithm that is used to manage a collection of disjoint sets. A disjoint set is a set in which… Read More
Given two integers N and M which denote the size of a matrix where initially all the cells are 0s. There are also K queries… Read More
Given an undirected graph of N node, where nodes are numbered from 1 to N, and an array of edges, where edges[i] = {edgeType, u,… Read More
Given a 2D array arr[] and value K, where each list in arr[] represents a point on Cartesian coordinates, the task is to group the… Read More
Given two strings str1 and str2 containing lowercase letters. The task is to convert the given string str3 into lexicographically smallest and largest string that… Read More
Given N vertices numbered from 0 to N – 1 and E edges to form an undirected graph. All the edges should be added in… Read More
Given a group of N people, each having a unique ID value from 0 to (N – 1) and an array arr[] of M elements… Read More
Given an array arr[] of N strings consisting of lowercase alphabets, the task is to find the number of distinct groups of strings formed after… Read More
Given a disconnected graph G with N vertices and M edges and an array cost[] corresponding to each vertex, the task is to find the… Read More
Given a positive integer N representing the set of integers [1, N] and an array queries[] of length Q of type {L, K}, the task… Read More
Given an array of pairs arr[][] of length N, and an array queries[] of length M, and an integer R, where queries[i] contain an integer… Read More
Given two arrays arr[](1-based indexing) and queries[] consisting of N integers and queries[] contains a permutation of the first N natural numbers, the task is… Read More
Given an undirected graph G(V, E)  consisting of2 N vertices and M edges, the task is to find the smallest vertex in the connected component… Read More