Advertisement
ismaeil

Function

Jul 24th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. vector< vector< int > > List;
  2. vector< int > Tmp;
  3.  
  4. void DFS(int u) {
  5.     Tmp.push_back(u);
  6.    
  7.     bool isLeaf = true;
  8.     for(auto v : Tree[u]){
  9.         isLeaf = false;
  10.         DFS(v);
  11.     }
  12.    
  13.     if( isLeaf ) List.push_back( Tmp );
  14.     Tmp.pop_back();
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement