Graph DataStructure
Graph always seems to be the complex data structure. Here is the one stop list of all the algorithm and summary of each.
- Dijkstra Algorithm: Shortest Path Problem from given starting node : Minimum spanning tree with given starting node: Greedy Method
- Bellman-Ford Algo: Shortest Path Problem from given starting node : Minimum spanning tree with given starting node with any Negative Weights
- Prim’s Algo
- Kruskal’s Algo
- Dijkstra Algo
- Floyd Warshall Algo
1.) Dijkstra Algorithm :
Dijkstra Algo is the basic and the simplest algorithm for finding the shortest path from the given starting point in a given connect cyclic/acyclic graph.
Points:
1.) Algo gives the shortest path from GIVEN starting point to other (Minimum spanning tree with given starting node)
2.) Works for cyclic/acyclic graph
3.) Negative weights cannot cater through this Algo (*negative weights signifies business logic )
Below are the Leetcode questions related to Dijkstra Algo:
- https://leetcode.com/problems/path-with-maximum-probability/
- https://leetcode.com/problems/network-delay-time/ ()
- https://leetcode.com/problems/the-maze-ii/
- https://leetcode.com/problems/the-maze-iii/
- https://leetcode.com/problems/path-with-minimum-effort/
- https://leetcode.com/problems/find-the-city-with-the-smallest-number-of-neighbors-at-a-threshold-distance/