Skip to content

Tag Archives: graph-connectivity

Given a positive integer N denoting the number of astronauts(labelled from 0 from (N – 1))and a matrix mat[][] containing the pairs of astronauts that… Read More
Given an undirected Graph consisting of N nodes in the form of an adjacency matrix graph[][] of size N*N, the task is to print all… Read More
Given a positive integer N, the task is to find the number of unique permutations of first N natural numbers having sum of the adjacent… 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 undirected graph consisting of N vertices and M edges and an array edges[][], with each row representing two vertices connected by an edge,… Read More
Given an undirected weighted graph G consisting of N vertices and M edges, and two arrays Edges[][2] and Weight[] consisting of M edges of the… Read More
Given two graphs G1 and G2, the task is to find the union and intersection of the two given graphs, i.e. (G1 ∪ G2) and… Read More
Given an array arr[][] consisting of N segments of the form {L, R, V} where, [L, R] denotes a segment with velocity V in any… 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 two positive integers N and K, the task is to construct a simple and connected graph consisting of N vertices with the length of… Read More
Tarjan’s Algorithm: The Tarjan’s Algorithm is an efficient graph algorithm that is used to find the Strongly Connected Component(SCC) in a directed graph by using… 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
Given two integers N and E which denotes the number of nodes and the number of edges of an undirected graph, the task is to… Read More