This list shows where you visited previously to get to each location. i.e. You came from HongKong to get to Sydney..
If current="AliceSprings",
while(prev[current]){// push "AliceSprings" in result listresult.push(current);// current will be "Sydney" with this linecurrent=prev[current];// continue until current="Dublin"}break;
Hope it helps! :)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks! Having trouble with this part:
Could you explain it step by step?
Maybe if you could explain what the final prev list looks like?
Hi Peter, thanks for the question!
If we run Dijkstras("Dublin", "AliceSprings"),
the final prev list should look like:
This list shows where you visited previously to get to each location. i.e. You came from HongKong to get to Sydney..
If current="AliceSprings",
Hope it helps! :)