diff --git a/dynamic_programming/floyd_warshall.cpp b/dynamic_programming/floyd_warshall.cpp index d193ebbd5..2a987779a 100644 --- a/dynamic_programming/floyd_warshall.cpp +++ b/dynamic_programming/floyd_warshall.cpp @@ -1,6 +1,7 @@ #include #include #include +#include using std::cin; using std::cout; @@ -53,7 +54,7 @@ void print(int dist[], int V) { // to all other vertices using Floyd-Warshall Algorithm. void FloydWarshall(Graph graph) { int V = graph.vertexNum; - int dist[V][V]; + std::vector > dist(V, std::vector(V)); // Initialise distance array for (int i = 0; i < V; i++)