Skip to content

Category Archives: Graph

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
Graph Coloring is the method to assign colors to certain elements of a graph. The most common method for this is the Vertex Coloring Method.… Read More
Given an adjacency matrix adj[][] of an undirected graph consisting of N vertices, the task is to find whether the graph contains a Hamiltonian Path… Read More
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 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