2

For the Floyd-Warshall's algorithm, the order of the loops is k, i, and j. What happens if I screw up the order of the loops and accidentally write it as i, k, and j? In what way will the program not work? Thanks!

Josh Zhang
  • 79
  • 1
  • 2
  • 3
    You get the Woyd-Flarshall algorithm, which produces dangerously bad jokes about computer science. – j_random_hacker Dec 17 '12 at 13:59
  • An interesting bit of trivia is that the algorithm will still be correct, as long as you run it three times (see https://arxiv.org/abs/1904.01210). – Evan Bailey Jul 26 '23 at 16:30

1 Answers1

0

Nothing. it gives you the result if you aren't tampering with that 3-level iteration during run-time. Floyd-Warshall always returns the shortest paths there are.

Yojimbo
  • 23,288
  • 5
  • 44
  • 48
ashley
  • 1,177
  • 1
  • 14
  • 17