Graphs
17 problems to practice.
Knights Tour
1. You are given a number n, the size of a chess board. 2. You are given a row and a column, as a s...
Has Path?
1. You are given a graph, a src vertex and a destination vertex. 2. You are required to find if a p...
Print All Paths
1. You are given a graph, a source vertex and a destination vertex. 2. You are required to find and...
Multisolver - Smallest, Longest, Ceil, Floor, Kthlargest Path
1. You are given a graph, a src vertex and a destination vertex. 2. You are give a number named "cr...
Get Connected Components Of A Graph
1. You are given a graph. 2. You are required to find and print all connected components of the gra...
Is Graph Connected
1. You are given a graph. 2. You are required to find and print if the graph is connected (there is...
Number Of Islands
1. You are given a 2d array where 0's represent land and 1's represent water. Assume every ce...
Perfect Friends
1. You are given a number n (representing the number of students). Each student will have an id...
Hamiltonian Path And Cycle
1. You are given a graph and a src vertex. 2. You are required to find and print all hamiltonian pa...
Is Graph Cyclic
1. You are given a graph. 2. You are required to find and print if the graph is cyclic.
Is Graph Bipartite
1. You are given a graph. 2. You are required to find and print if the graph is bipartite Note -...
Breadth First Traversal
1. You are given a graph, and a src vertex. 2. You are required to do a breadth first traversal and...
Spread Of Infection
1. You are given a graph, representing people and their connectivity. 2. You are also given a src p...
Shortest Path In Weights
1. You are given a graph and a source vertex. The vertices represent cities and the edges represent...
Minimum Wire Required To Connect All Pcs
1. You are given a graph and a source vertex. The vertices represent computers and the edges...
Order Of Compilation
1. You are given a directed acyclic graph. The vertices represent tasks and edges represent de...
Iterative Depth First Traversal
1. You are given a graph, and a source vertex. 2. You are required to do a iterative depth first tr...