Skip to content

Category Archives: Graph

Given a matrix of dimension m*n where each cell in the matrix can have values 0, 1 or 2 which has the following meaning:   0:… Read More
Round 1 (Written) Around 140 students appeared for the offline test.  There were 20 MCQs that to be done in (30 minutes), questions were from OS,DBMS,Datastructures. After… Read More
We have introduced and discussed below Karger’s algorithm in set 1. 1) Initialize contracted graph CG as copy of original graph 2) While there are… Read More
Given a number line from -infinity to +infinity. You start at 0 and can go either to the left or to the right. The condition… Read More
What is Steiner Tree? Given a graph and a subset of vertices in the graph, a steiner tree spans though the given subset. The Steiner… Read More
Given an undirected graph, print all connected components line by line. For example consider the following graph. Attention reader! Don’t stop learning now. Get hold… Read More
Given an undirected and unweighted graph, find the smallest cut (smallest number of edges that disconnects the graph into two components). The input graph may have… Read More
We have discussed following topics on Minimum Spanning Tree. Applications of Minimum Spanning Tree Problem Kruskal’s Minimum Spanning Tree Algorithm Prim’s Minimum Spanning Tree AlgorithmAttention… Read More
Given a graph with both directed and undirected edges. It is given that the directed edges don’t form cycle. How to assign directions to undirected… Read More
Given n cities and distances between every pair of cities, select k cities to place warehouses (or ATMs or Cloud Server) such that the maximum… Read More
There are N stations on route of a train. The train goes from station 0 to N-1. The ticket cost for all pair of stations… Read More
We have earlier discussed Breadth First Traversal Algorithm for Graphs. We have also discussed Applications of Depth First Traversal. In this article, applications of Breadth… Read More
A person is determined to finish the book in ‘k’ days but he never wants to stop a chapter in between. Find the optimal assignment… Read More
Given a directed graph, a source vertex ‘s’ and a destination vertex ‘d’, print all paths from given ‘s’ to ‘d’. Consider the following directed graph.… Read More
Given a number of friends who have to give or take some amount of money from one another. Design an algorithm by which the total… Read More