mirror of https://github.com/TheAlgorithms/C
Update dijkstra.c (#928)
in this way valgrind checks will pass and result will stay the same (functions as a static variable)
This commit is contained in:
parent
bd06a9f424
commit
0ceb3b340e
|
@ -32,7 +32,8 @@ void addEdge(struct Graph *G, int src, int dst, int weight)
|
|||
// Utility function to find minimum distance vertex in mdist
|
||||
int minDistance(int mdist[], int vset[], int V)
|
||||
{
|
||||
int minVal = INT_MAX, minInd;
|
||||
int minVal = INT_MAX;
|
||||
static int minInd = -1; //remembers the previous value if not modified in the loop
|
||||
for (int i = 0; i < V; i++)
|
||||
if (vset[i] == 0 && mdist[i] < minVal)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue