Comments
On himanshujaju → 0-1 BFS [Tutorial], 6 years ago
0

Can someone explain how the time complexity is O(V+E), suppose we have 5 nodes as numbered from 0-4, thus let we explore node 1 and its weight is found to be 1 and push back and after some time the node 1 is again explored and updated weight is 0 as explored from another node and push in front of queue, and now are queue has two 1's thus we explore them twice and this is would be the case for most of the nodes thus,how the complexity be O(V+E)?