I am not able to understand when -1 is to be printed and explain me the below mentioned code from line 62 onwards

hello @Vipul.kapoor
image

a) i==src it means we are on the source node and as per question they asked us to skip its distance thats why we are using continue.

b) dist.count will return 0 or 1.
1 if i is present in map
0 if i is not present in map.
0 here indicates that the node i is not reachable from the source hence we need to print -1 in that case. and that what we are doing here

c) for other cases dist[i]*6

sir could you elaborate find() function
rest all is clear

The map::find() is a built-in function in C++ STL which returns an iterator or a constant iterator that refers to the position where the key is present in the map. If the key is not present in the map container, it returns an iterator or a constant iterator which refers to map.end() .
for more details refer this ->article

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.