#341 - Non-Stop Travel| Solved By: | wesley | | Theory Difficulty: | easy | | Coding Difficulty: | easy | | Algorithms Used: | dijkstra
| | Solution Description: | Pretty standard Dijkstra problem. Keep an array p[] where p[i] is the "parent" of node i. That is, the node before i in the path. Whenever you update the distance to node i, set p[i] to whatever node you're currently expanding. Use p[] at the end to reconstruct the path by working backwards from the end. |
Copyright 2008 (c) QuestToSolve.Com - Graphs Powered By
|