Dijkstra's Algorithm wrong output


giving wrong on testcase why?

Hello @mddanish,

  1. The order of your output is wrong:
    Example:
    1
    4 4
    1 2 100000
    1 4 10000
    3 1 3
    4 3 100000
    4
    Your Output:
    110000 10000 10003
    Expected Output:
    10000 110000 10003
    (for 1)(for 2)(for 3)

  2. You have to print -1 if the node is unreachable from the node S.
    1
    4 2
    1 2 100000
    1 4 10000
    4
    Your Output:
    110000 10000
    Expected Output:
    10000 110000 -1

Hope, this would help.
Give a like, if you are satisfied.