i think the value of dist[i] is not getiing updated int the loop as it is printing -1 for all nodes
Why it is not updating the value?
here it should be == while u had used =
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.
the code above got submitted but i am not able to figure it out ho this condition dist[i]==0 is working in the code as only the src will have distance as zero and that we are skipping in with the continue statement?
Hi @we_kaash… so some of the nodes whos distance is not being initialized as INT_MAX as they may not be connected so their by default distance is considered as 0 as no distance is stored for them in map
ohhhh it just got skipped of my mind…thanks