Dijkstra's algorithm

medium

When a node comes off the priority queue it is final - no unexplored route can beat it. Set an edge weight negative to watch that greedy argument fail.

Worst O((V + E) log V)Space O(V)
Loading the dijkstra's algorithm engine…

Where to go next