Tag Archives: Shortest Path

Given a matrix that is filled with ‘O’, ‘G’, and ‘W’ where ‘O’ represents open space, ‘G’ represents guards and ‘W’ represents walls in a… Read More
Given a path in the form of a rectangular matrix having few landmines arbitrarily placed (marked as 0), calculate length of the shortest safe route… Read More
Given a screen containing alphabets from A-Z, we can go from one character to another characters using a remote. The remote contains left, right, top… Read More
Given a MxN matrix where each element can either be 0 or 1. We need to find the shortest path between a given source cell… Read More
Dijkstra’s shortest path algorithm runs in O(Elog V) time when implemented with adjacency list representation (See C implementation and STL based C++ implementations for details).… Read More
Given a graph and a source vertex in graph, find shortest paths from source to all vertices in the given graph. Input : Source =… Read More
Given a graph and a source vertex in graph, find shortest paths from source to all vertices in the given graph. Input : Source =… Read More
Given a graph and a source vertex in graph, find shortest paths from source to all vertices in the given graph. We have discussed Dijkstra’s… Read More
Given a directed graph where every edge has weight as either 1 or 2, find the shortest path from a given source vertex ‘s’ to… Read More
filter_none edit close play_arrow link brightness_4 code import java.util.Scanner; //Scanner Function to take in the Input Values    public class Dijkstra {     static Scanner scan;… 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
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 and two vertices ‘u’ and ‘v’ in it, find shortest path from ‘u’ to ‘v’ with exactly k edges on the path.… Read More
Question 1: Given a directed weighted graph. You are also given the shortest path from a source vertex ‘s’ to a destination vertex ‘t’.  If… Read More
The problem is to find shortest paths between every pair of vertices in a given weighted directed Graph and weights may be negative. We have… Read More