Skip to content
Related Articles

Related Articles

Algorithms | Graph Shortest Paths | Question 7
  • Last Updated : 19 Nov, 2018

What is the time complexity of Bellman-Ford single-source shortest path algorithm on a complete graph of n vertices?

(A) \Theta(n^2)
(B) \Theta(n^2 Logn)
(C) \Theta(n^3)
(D) \Theta(n^3 Logn)

Answer: (C)

Explanation: Time complexity of Bellman-Ford algorithm is \Theta(VE) where V is number of vertices and E is number edges (See this). If the graph is complete, the value of E becomes \Theta(V^2). So overall time complexity becomes \Theta(V^3)

Quiz of this Question

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :