wrong output…please tell the mistake
Single source shortest path using bfs graphs
0 --> 0
1 --> 1
2 --> 2
3 --> 3
4 --> 4
5 --> 5
this output is wrong
that is just a setup for competitive programming
@hg11110000 i know it is setup for competitive programming but you can see for yourself what the issue is.
0 --> 0
1 --> 1
2 --> 1
3 --> 1
4 --> 2
5 --> 3
this should be the output
like shortest distance from source 0 to every node ??
@hg11110000 look at the graph input you provided, draw it on pen and paper.
Your graph is like this
0 - 1 - 2 - 3 - 4 - 5
So the output is correct
oops ! gave wrong input
missed one edge
1 Like
yes…thanks :)…

