What is the time complexity of the Floyd-Warshall algorithm used for finding shortest paths in a weighted graph?

  • O(E log V)
  • O(V log V)
  • O(V^2)
  • O(V^3)
The time complexity of the Floyd-Warshall algorithm is O(V^3), where V is the number of vertices in the graph. This algorithm efficiently computes the shortest paths between all pairs of vertices in a weighted graph, making it suitable for dense graphs.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *