Exercise: Find the Shortest Path in a Small Town
Apply what you have learned about shortest path algorithms to find the shorter distance from one location to another in a town.
Problem statement
You are the city planner for a small town with ten distinct locations (nodes) connected by roads (edges). The locations are represented by letters A to J, and the roads have different distances (weights) between them. Your task is to find the shortest route between the town's hospital (A) and the fire station (J) to ensure efficient emergency response.
The town map and distances between locations are as follows:
Get hands-on with 1300+ tech skills courses.