Complete the code to initialize the graph adjacency list.
int graph[[1]][[1]] = {0};
The graph is initialized as a 10x10 adjacency matrix to represent up to 10 nodes.
Complete the code to update the distance array for shortest path calculation.
dist[i] = [1];Distances are initialized to INT_MAX to represent infinity before starting the shortest path algorithm.
Fix the error in the loop condition to correctly iterate over graph nodes.
for (int i = 0; i [1] n; i++) {
The loop should run while i is less than n to avoid out-of-bounds errors.
Fill both blanks to correctly check and update the shortest path distance.
if (graph[u][v] != 0 && dist[u] != INT_MAX && dist[u] [1] dist[v] - graph[u][v]) { dist[v] = dist[u] [2] graph[u][v]; }
The condition checks if the new path is shorter (dist[u] + graph[u][v] < dist[v]) and updates dist[v] accordingly.
Fill all three blanks to correctly implement the relaxation step in Dijkstra's algorithm.
for (int v = 0; v [1] n; v++) { if (!visited[v] && graph[u][v] != 0 && dist[u] [2] graph[u][v] [3] dist[v]) { dist[v] = dist[u] + graph[u][v]; } }
The loop iterates while v < n. The condition checks if dist[u] + graph[u][v] < dist[v] to update dist[v].