Which algorithm efficiently calculates the single source shortest paths in a Directed Acyclic Graph?

Which algorithm efficiently calculates the single source shortest paths in a Directed Acyclic Graph?
A. topological sort
B. hash table
C. binary search
D. radix sort
 
Answer: a
Explanation: For Directed Acyclic graph, single source shortest distances can be calculated in O(V+E) time. For that purpose Topological Sorting can be used. Topological Sorting of any graph represents a linear ordering of the graph.
 

Tìm kiếm

Back
Top