What is the complexity of the Floyd-Warshall algorithm?
What is the complexity of the Floyd-Warshall algorithm?
Approach: Analyze the triple-nested loop structure.
O(V^3), where V is the number of vertices. Each of the three nested loops runs V times.
Follow-up: What is the space complexity?
Key concepts: O(V^3), all-pairs shortest path.