GATE Exam | Aptitude Questions | GATE Syllabus | GATE Result | Mock Test | GATE Preparation
0 votes

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)

asked in Asymptotic worst case time and space complexity by gate

1 Answer

0 votes
Floyd–Warshall algorithm uses three nested loops to calculate all pair shortest path. So, time complexity is Thete(n^3)
answered by gate

Related questions

The best answer to any question