I'm not really understanding my algorithms class. One of our HW assignments is to design an efficient algorithm for this graph
Give an efficient algorithm to find the fastest route for Alice to leave home, reach some gas station, then get to work.
On her way home, Alice wants to visit both a grocery store and a hardware store (in some order). Give an efficient algorithm to find the fastest route for Alice to leave work, visit both stores, and get home.
I was thinking something along the lines of A* search and make Gas Stations have a 0 heuristic, or something like create a list of the shortest paths and choose the shortest path with a gas station?
Honestly, I don't know how to implement this. How do I go about reasoning about this?
For example, how would I implement my second solution?