Algorithms | Analysis of Algorithms | Question 12
What is the time complexity of Floyd–Warshall algorithm to calculate all pair shortest path in a graph with n vertices?
(A) O(n^2logn)
(B) Theta(n^2logn)
(C) Theta(n^4)
(D) Theta(n^3)
Answer: (D)
Explanation: Floyd–Warshall algorithm uses three nested loops to calculate all pair shortest path. So, time complexity is Thete(n^3). Read here for more details.
Quiz of this Question