Skip to content

# Category Archives: Graph

Given a Directed Tree consisting of N nodes, the task is to check if there exists a node in the given tree such that all… Read More
Given a matrix arr[][], consisting of only 0, 1, and 2, that represents an empty ward, an uninfected patient, and an infected patient respectively. In… Read More
For a connected and undirected graph, a spanning tree of that graph is a subgraph that is a tree and connects all the vertices together.… Read More
Given a directed weighted graph consisting of N vertices and an array Edges[][], with each row representing two vertices connected by an edge and the… Read More
Independent sets are set of vertices or edges in which the pair of any two vertices or edges are not adjacent to each other. Assuming… Read More
Gabow’s Algorithm is a scaling algorithm that aims in solving a problem by initially considering only the highest order bit of each relevant input value… Read More
Given an N-ary tree consisting of N nodes numbered from 1 to N rooted at node 1, the task is to assign values to each… Read More
Given an integer N, representing the number of stairs, valued from 1 to N, and a starting position S, the task is to count the… Read More
Given a weighted graph consisting of N nodes and M edges, a source vertex, a destination vertex, and an integer K, the task is to… Read More
Given a binary matrix mat[][] of dimensions of N * M and pairs of integers src and dest representing source and destination cells respectively, the… 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 a binary matrix mat[][] that represents the adjacency matrix representation of a graph, where mat[i][j] as 1 represents that there is an edge between… Read More
Given a 2D array Edges[][], representing a directed edge between the pair of nodes in a Directed Acyclic Connected Graph consisting of N nodes valued… Read More
Given a Graph consisting of N vertices and M weighted edges and an array edges[][], with each row representing the two vertices connected by the… 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