Dijkstra's Shortest path algorithm


code runs fine on my ide, but gives the wrong answer. Please check the code

hello @shivanshu12800
image

ur dist will not contain all the keys [1…n] but in problem it is asked to print distance in order [1…n] except src.
so u loop and iterate from 1 to n and print its distance

its solved, Thank you!!

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.