Skip to content

Instantly share code, notes, and snippets.

@hmthanh
Created April 16, 2019 07:17
Show Gist options
  • Save hmthanh/b276b2e46303fd3fbd9942433f29f7c8 to your computer and use it in GitHub Desktop.
Save hmthanh/b276b2e46303fd3fbd9942433f29f7c8 to your computer and use it in GitHub Desktop.
Thuật toán FloyWarshall
for (int k = 0; k < length; k++) {
for (int i = 0; i < length; i++) {
for (int j = 0; j < length; j++) {
if (dist[i][j] > dist[i][k] + dist[k][j]) {
dist[i][j] = dist[i][k] + dist[k][j];
path[i][j] = path[k][j];
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment