Examveda

What is the purpose of the 'distance' array in Dijkstra's algorithm?

A. To store the order of node visits.

B. To track the number of edges.

C. To store the parent nodes for each node.

D. To store the shortest distance from the source to each node.

Answer: Option D


Join The Discussion

Related Questions on Graph Algorithms (DFS, BFS, Dijkstras, etc)