how can BFS revisit 0?

Back to General discussions forum

Goodwin Lu     2020-07-02 15:21:26

I read the problem but it still seems confusing, why is the answer often visiting 0 multiple times? If you BFS from the node "0" shouldn't it practically never be visited?

Rodion (admin)     2020-07-03 10:36:36
User avatar

Hi Friend!

As output you should produce the seen array which shows where each vertex was visited from.

The output contains not the numbers of the nodes in order, but where given node was reached from! Sorry for confusion...

Please login and solve 5 problems to be able to post at forum