Algorithm · Palantir · Medium
An undirected road network is modeled in code. A city is a Place. A Route stores a starting Place, an ending Place, and an integer length. A Reach stores a destination Place and a length. A Route is not one-way: traveling from its start to its end costs the same as traveling from its end to its start. The current implementation incorrectly treats every Route as directed. Complete or review the graph logic for the tasks below. For the two shortest-path procedures, also state…
Checking your access…