Algorithms | Dynamic Programming | Question 7
What is the time complexity of Bellman-Ford single-source shortest path algorithm on a complete graph of n vertices?
(A)
θ(n2)
(B)
θ(n2 log n)
(C)
θ(n3)
(D)
θ(n3 log n)
Answer: (C)
Explanation:
Time complexity of Bellman-Ford algorithm is O(VE) where V is number of vertices and E is number of edges. For a complete graph with n vertices, V = n, E = O(n2). So overall time complexity becomes O(n3)
Quiz of this Question
Please comment below if you find anything wrong in the above post
Last Updated :
28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...