Dijkstra: Shortest Reach 2

  • [deleted]
    + 2 comments

    I really need a hint on how to fix my algorithm(I can only pass 3 test cases, the rest timeout) it works but I have to loop over the entire (multidimensional)array every time i get to a new node. should I store each vertex pair with atleast 1 corresponding vertex in an array and put those in an array?

    I suppose I could order the vertex pairs so the vertex with the lowest number goes first and then sort it, allowing easier lookups, am I on the right track here?