FIRESC solution not working

So I sat down to plunge myself into graphs.

http://discuss.codechef.com/questions/17801/introduction-to-graphs-definitions-traversal-depth-first-search

The code below is 99% copy-paste of the code posted by @kuruma in the above post. Yet, it reports FIRESC.exe has stopped working as soon as I enter the inputs for the 1st test case. But the code in the above link works fine (obviously!).

https://www.dropbox.com/s/8u6rit6t26hmxh3/Trying%20FIREESC.cpp?dl=0

I’ve compared the codes repeatedly and spent hours debugging and trying to figure out the cause of the mishap. But to no avail. Could anyone out there please help me out?

You may laugh at the mistake :stuck_out_tongue:

In line 12 you have used equality check instead of assignment operator.

visited[v]==true;
instead of 
visited[v]=true;
1 Like

I didn’t laugh, I cried at the mistake :stuck_out_tongue: I spent suchhhh a loooong time, hours trying to find the error! :open_mouth: I thought I hadn’t understood dfs and hence it wasn’t working. Thank you soo much for answering even though the error was stupid. :stuck_out_tongue: