Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. void TopSort()
  2.  
  3. {
  4. for (int i = 1; i <= node; i++)
  5.  
  6. {
  7. DFS(i);
  8. }
  9. if (hasCycle)
  10. {
  11. cout<<"IMPOSSIBLE"<<endl;
  12. return ;
  13. }
  14.  
  15. while(!s.empty())
  16. {
  17. cout<<s.top()<<endl;
  18. s.pop();
  19. }
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement