GeeksforGeeks » Algorithms
Bellman Ford and Dijkstra Algos for single source shortest paths
(3 posts)-
What are the differences Bellman Ford and Dijkstra Algos for single source shortest paths?
-
Dijkstra and Bellman Ford are two algorithms for single source shortest path problem.
Dijkstra's Algo
1) Dijkstra is a Greedy based algorithm and similar to Prom's MST algo.
2) Dijkstra doesn't work for negative weight edges.
3) Time complexity of Dijkstra is O(|E| + |V|Log|V|)
4) Dijkstra's algorithm is usually the working principle behind link-state routing protocols, OSPF and IS-ISBellman-Ford's Algo
1) Bellman-Ford is a Dynamic Programming based algorithm.
2) Bellman-Ford worka for negative weight edges.
3) Time complexity of Bellman Ford takes O(|V||E|) time which can also be written as O(|V|^3)
4) A distributed variant of the Bellman–Ford algorithm is used in distance-vector routing protocols. -
Thanks a lot.
Reply
You must log in to post.