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

Share your thoughts in the comments