Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void TopSort()
- {
- for (int i = 1; i <= node; i++)
- {
- DFS(i);
- }
- if (hasCycle)
- {
- cout<<"IMPOSSIBLE"<<endl;
- return ;
- }
- while(!s.empty())
- {
- cout<<s.top()<<endl;
- s.pop();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement