Skip to content
Related Articles

Related Articles

Algorithms | Analysis of Algorithms | Question 12

View Discussion
Improve Article
Save Article
  • Last Updated : 28 Jun, 2021

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!