Not gettting the correct answer plz help me correct the codeā¦
Dijkstras Algorithm
Hey @aryamaan1011
Replace line 91-96 by
for(int i=1;i<=nodes;i++){ if(i == src) continue; auto f = dis.find(i); if(f != dis.end()&&dis[i]!=INT_MAX){ cout<<dis[i]<<" ā; } else{ cout<<ā-1"<<" "; } }
We are printing like this because in map order of elements inserted can be different(shuffled).