Skip to content

Tag Archives: Dijkstra

Dijkstra’s algorithm is very similar to Prim’s algorithm for minimum spanning trees. Like Prim’s MST, we generate a SPT (shortest path tree) with a given… Read More
Dijkstra’s algorithm is one of the most popular algorithms for solving many single-source shortest path problems having non-negative edge weight in the graphs i.e., it… Read More
Given a graph of N Nodes and E edges in form of {U, V, W} such that there exists an edge between U and V… Read More
Given a directed graph and a source vertex in the graph, the task is to find the shortest distance and path from source to target… Read More
Given a matrix of size N x M consisting of integers 1, 2, 3 and 4. Each value represents the possible movement from that cell:  1… Read More
Given a directed graph with N nodes and E edges, a source S and a destination D nodes. The task is to find the path… Read More
Given a directed graph with N nodes and E edges where the weight of each of the edge is > 1, also given a source… Read More
Bellman Ford’s algorithm Like other Dynamic Programming Problems, the algorithm calculates shortest paths in a bottom-up manner. It first calculates the shortest distances which have at-most… Read More
It is highly recommended to read Dijkstra’s algorithm using the Priority Queue first.Widest Path Problem is a problem of finding a path between two vertices… Read More
Given an array arr[] of size N where every element is from the range [0, 9]. The task is to reach the last index of… Read More
Given an undirected unweighted graph. The task is to find the length of the shortest cycle in the given graph. If no cycle exists print… Read More
Given a number N, find the minimum possible sum of digits that can be obtained from a positive Multiple of N. Constraints : 1<=N<=10^5. Examples:… Read More
Given a directed weighted graph and the source and destination vertex. The task is to find the sum of shortest distance on the path going… Read More
Given a connected graph with N vertices and M edges. The task is to find the shortest path from source to the destination vertex such… Read More