Single Choice Easy

QWhat is the time complexity of the Floyd-Warshall algorithm for all-pairs shortest paths in a weighted graph?

ID: #21506 Time Complexity 122 views
Question Info
#21506Q ID
EasyDifficulty
Time ComplexityTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A O(N) ✔ ✖
  • B O(log N) ✔ ✖
  • C O(N^2) ✔ ✖
  • D O(V^3), where V is the number of vertices. ✔ ✖
Correct Answer

Explanation

The Floyd-Warshall algorithm has a cubic time complexity of O(V^3) for finding all-pairs shortest paths in a weighted graph.

Share This Question

Challenge a friend or share with your study group.