Connected Components in an undirected graph
Given an undirected graph, print all connected components line by line. For example consider the following graph. We strongly recommend to minimize your browser and… Read More »
Given an undirected graph, print all connected components line by line. For example consider the following graph. We strongly recommend to minimize your browser and… Read More »
Given a list of word lists How to print all sentences possible taking one word from a list at a time via recursion? Example: Input: {{“you”,… 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 dictionary, a method to do lookup in dictionary and a M x N board where every cell has one character. Find all possible… Read More »
Write a function that returns true if a given undirected graph is tree and false otherwise. For example, the following graph is a tree. But… Read More »
Given a snake and ladder board, find the minimum number of dice throws required to reach the destination or last cell from source or 1st… Read More »
Given a directed graph and two vertices ‘u’ and ‘v’ in it, count all possible walks from ‘u’ to ‘v’ with exactly k edges on… Read More »
Eulerian Path is a path in graph that visits every edge exactly once. Eulerian Circuit is an Eulerian Path which starts and ends on the… Read More »
Given an undirected graph, how to check if there is a cycle in the graph? Example, Input: n = 4, e = 4 Output: Yes… Read More »
Given a directed graph, find out whether the graph is strongly connected or not. A directed graph is strongly connected if there is a path… Read More »
A vertex in an undirected connected graph is an articulation point (or cut vertex) iff removing it (and edges through it) disconnects the graph. Articulation… Read More »
A directed graph is strongly connected if there is a path between all pairs of vertices. A strongly connected component (SCC) of a directed graph… Read More »
Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge uv, vertex u comes before v… Read More »
A Bipartite Graph is a graph whose vertices can be divided into two independent sets, U and V such that every edge (u, v) either… Read More »
Given a boolean 2D matrix, find the number of islands. A group of connected 1s forms an island. For example, the below matrix contains 5… Read More »