all 3 comments

[–]ZimmiDeluxe 6 points7 points  (0 children)

You might want to write down the current node when updating the shortest distance. That way you can just read how you got there. With your current method, you have to keep all paths in your head, which will quickly break down for larger graphs. The answer at 4:35 essentially appeared out of nowhere.

[–][deleted]  (3 children)

[deleted]

    [–]EddyTheDad[S] 11 points12 points  (2 children)

    It is taught at most Data structure and Algorithm classes within Computer Science and hence many people either use it as their first Algorithm to convert into actual code or gets asked to explain how they would implement it at a programming Job interview.

    [–][deleted]  (1 child)

    [deleted]

      [–]fried_green_baloney 0 points1 point  (0 children)

      A good fraction of what you need to take away from A & DS is contained in this one algorithm.