Skip to content

Category Archives: Graph

Given a connected acyclic graph consisting of V vertices and E edges, a source vertex src, and a destination vertex dest, the task is to… Read More
Given a matrix arr[][] of dimensions N * M, having elements 0, 1, and 2. There is only one cell with value 1 present in… Read More
Given two strings start and target(both of the same length) and a list of strings str[], the task is to print all possible smallest sequences… Read More
Given an undirected graph G, with V vertices and E edges, the task is to check whether the graph is 2-edge connected or not. A… Read More
Given two arrays A[] and B[] consisting of N positive integers and a matrix List[][] consisting of M pairs of indices, the task is to… Read More
Given an Undirected Connected Graph in the form of a tree consisting of N nodes and (N – 1) edges, the task for each edge… Read More
Given two natural numbers N and M, Create a graph using these two natural numbers using relation that a number is connected to its largest… Read More
Dijkstra’s algorithm is one of the most popular algorithms for solving many single-source shortest path problems having non-negative edge weight in the graphs i.e., it… Read More
Given a Directed Acyclic Graph having V vertices and E edges, where each edge {U, V} represents the Jobs U and V such that Job… Read More
Given a binary matrix mat[][] of dimensions NxM such that 1 denotes the island and 0 denotes the water. The task is to find the… Read More
Prerequisites: DFS, Trees, DSU Given a tree with of N nodes from value 1 to N and E edges and array arr[] which denotes number… Read More
Given an Acyclic Undirected Graph in the form of a Binary Tree with the root at vertex 1 and values at each vertex [1, N]… Read More
Given a boolean matrix mat[][] consisting of N rows and M columns, initially filled with 0‘s(empty cells), an integer K and queries Q[][] of the… Read More
Given two integers R and C, denoting the number of rows and columns in a matrix, and two integers X and Y, the task is… Read More