Open In App

Algorithms | Analysis of Algorithms | Question 12

Last Updated : 28 Jun, 2021
Like Article
Like
Save
Share
Report

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


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads