Given N nodes, where each of them is numbered from 0 to N – 1, and array edges, where there is a directed edge from… Read More

# Tag Archives: connected-components

Given a directed graph with N nodes and M edges in array V[], the task is to find the number of nodes that are accessible… Read More

Given an undirected graph g, the task is to find the number of coalitions formed in it after the removal of Q vertices and maximum… Read More

Given, a Tree with N nodes, and an integer P, the task is to remove at edges in range [1, P) and find the XOR… Read More

Given an array A[] of size N, for each index i in the range [0, N) the value A[i] denotes the size of the connected… Read More

Given a matrix mat[][] containing only of 0s and 1s, and an array queries[], the task is for each query, say k, is to find… Read More

Given an array arr[] consisting of N strings representing the name of the students in the class and another array of pairs P[][2] such that… Read More

Given an array arr[] consisting of values of N vertices of an initially unconnected Graph and an integer M, the task is to connect some… Read More

Given an undirected graph consisting of V vertices and a 2d array E[][2] denoting edges between pairs of nodes. Given another array arr[] representing values… Read More

Given an undirected graph G with vertices numbered in the range [1, N] and an array Edges[][] consisting of M edges, the task is to… Read More

Given an integer N, denoting the number of computers connected by cables forming a network and a 2D array connections[][], with each row (i, j)… Read More

Given an undirected graph G with vertices numbered in the range [0, N] and an array Edges[][] consisting of M edges, the task is to… Read More

Given an n-ary tree T, the task is to find a node whose removal minimizes the maximum size of all forests(connected components) generated. Examples: Input: … Read More

Given an undirected graph G with N nodes, M edges, and an integer K, the task is to find the maximum count of edges that… Read More

Given a Tree consisting of N nodes valued in the range [0, N) and an array Queries[] of Q integers consisting of values in the… Read More