Q. In which scenario would Dijkstra's algorithm be most useful?
A.
Finding the maximum element in an array
B.
Calculating the shortest distance between cities on a map
C.
Sorting a list of names alphabetically
D.
Searching for a specific value in a linked list
Solution
Dijkstra's algorithm is most useful for calculating the shortest distance between cities on a map, as it efficiently finds the shortest paths in weighted graphs.
Correct Answer:
B
— Calculating the shortest distance between cities on a map
Q. What is a real-world application of the shortest path algorithms like Dijkstra's?
A.
Web page ranking
B.
Network routing
C.
Data compression
D.
Image processing
Solution
Network routing is a real-world application of shortest path algorithms, as they help determine the most efficient paths for data packets to travel across networks.