Algorithms and Data Structures · Senior · Question 4 of 75

What is the complexity of Floyd-Warshall, and when is it a reasonable choice?

Explanation

It's three nested loops over vertices, updating dist[i][j] through every intermediate k. Simple and handles negative edges (without negative cycles), but at V = 10,000 it's already 10¹² steps.

Further reading

Problem with a question

Algorithms and Data Structures · Senior · question 4

Test yourself

Take the Algorithms and Data Structures · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz