Dijkstra Algorithm

2019-02-15  本文已影响0人  宇翔_0e77

1. 两个list的nodes,searched and unsearched

2. start from a source node. 

3. go to its neighbors, calculate their distances to the source node. 

4. Use a priority queue or something, always find the node with shortest distance to the source node. 

5. Repeat the steps from 3-4, until no nodes exist in the priority queue. 

https://www.geeksforgeeks.org/dijkstras-shortest-path-algorithm-greedy-algo-7/

https://leetcode.com/problems/network-delay-time/submissions/

上一篇 下一篇

猜你喜欢

热点阅读