Dijkstra's algorithm a greedy or dynamic programming algorithm?

vkaul11 picture vkaul11 · Dec 26, 2012 · Viewed 12.4k times · Source

In this post it is described Dijkstras as a greedy algorithm, while here and here it is shown to have connections with dynamic programming algorithms.

Which one is it then?

Answer

Grigor Gevorgyan picture Grigor Gevorgyan · Dec 26, 2012

It's greedy because you always mark the closest vertex. It's dynamic because distances are updated using previously calculated values.