Given a directed graph of N vertices valued from 0 to N – 1 and array graph[] of size K represents the Adjacency List of… Read More

# Tag Archives: graph-connectivity

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 a graph consisting of N nodes, where each node represents an exam and a 2D array Edges[][2] such that each pair of the exam… Read More

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 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 integer N, representing the number of nodes present in an undirected graph, with each node valued from 1 to N, and a 2D… 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