Skip to content

Category Archives: Graph

Given a generic tree consisting of N nodes and (N – 1) edges and an array of queries query[] of size Q consisting of the… Read More
Given a Graph having N+1 nodes with 2*N-1 edges and a boolean array arr[ ], the task is to find if one can visit every… Read More
Given an undirected and unweighted graph of N nodes and M edges, the task is to count the minimum length paths between node 1 to… 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 a weighted undirected graph consisting of N nodes and M edges, the task is to find the shortest distance between two nodes A and… Read More
Dijkstra’s Algorithm: It is a graph searching algorithm that uses a Greedy Approach to find the shortest path from the source node to all other… Read More
Mother vertex: A mother vertex in a Graph G = (V, E) is a vertex v such that all other vertices in  G can be… Read More
Given an unweighted bidirectional graph containing N nodes and M edges represented by an array arr[][2]. The task is to find the difference in length… Read More
Given a directed and weighted graph of N nodes and M edges, the task is to count the number of shortest length paths between node… 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
An Adjacency List is used for representing graphs. Here, for every vertex in the graph, we have a list of all the other vertices which… Read More
Problem Description: A city is represented as a two-dimensional rectangular matrix. The outer wall of the given matrix denotes the boundaries of the city. Citizens… Read More
Prerequisites – Graph, Spanning tree, Disjoint Set (Union – Find). A minimum spanning tree (MST) T, for a given graph G, spans over all vertices… Read More
Given an array arr[] consisting of N integers, the task is to find the minimum cost to sort the given array arr[] in ascending order… Read More

Start Your Coding Journey Now!