Skip to content

Commit b796161

Browse files
fix: vla in floyd_warshall
1 parent 46f423c commit b796161

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

dynamic_programming/floyd_warshall.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <climits>
22
#include <iostream>
33
#include <string>
4+
#include <vector>
45

56
using std::cin;
67
using std::cout;
@@ -53,7 +54,7 @@ void print(int dist[], int V) {
5354
// to all other vertices using Floyd-Warshall Algorithm.
5455
void FloydWarshall(Graph graph) {
5556
int V = graph.vertexNum;
56-
int dist[V][V];
57+
std::vector<std::vector<int> > dist(V, std::vector<int>(V));
5758

5859
// Initialise distance array
5960
for (int i = 0; i < V; i++)

0 commit comments

Comments
 (0)