I have written the code for kosaraju’s algorithm for finding the scc, Its giving wrong answer for this graph:-
here’s the code:- http://ideone.com/3uxMdo
Whats wrong in the code?
I have written the code for kosaraju’s algorithm for finding the scc, Its giving wrong answer for this graph:-
here’s the code:- http://ideone.com/3uxMdo
Whats wrong in the code?
Although, it is quite a long time after you asked. The mistake is that on line 59 it should have been !used[order[i]]
instead !used[i]
(since you do not want to check whether the index was used, but rather the node).