Algorithms | Graph Shortest Paths | Question 7

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)

(A) A
(B) B
(C) C
(D) D


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



My Personal Notes arrow_drop_up