Skip to content
Related Articles
Open in App
Not now

Related Articles

Algorithms | Analysis of Algorithms | Question 12

Improve Article
Save Article
Like Article
  • Last Updated : 28 Jun, 2021
Improve Article
Save Article
Like Article

What is the time complexity of Floyd–Warshall algorithm to calculate all pair shortest path in a graph with n vertices?

(A)

O(n2log(n))

(B)

Theta(n2log(n))

(C)

Theta(n4)

(D)

Theta(n3)


Answer: (D)

Explanation:

Floyd–Warshall algorithm uses three nested loops to calculate all pairs shortest path. So, the time complexity is Theta(n3).
Please read here for more details.


Quiz of this Question
Please comment below if you find anything wrong in the above post

My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!