farhin_khaled

All Possible Subset

Oct 24th, 2021
692
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void allsubsets(vector < int > &set, vector < int > &sub, int n, int index){
  2.     if(index == n){
  3.         print(sub);
  4.         return;
  5.     }
  6.     sub.pb(set[index]);
  7.     allsubsets(set, sub, n, index+1);
  8.     sub.pop_back();
  9.     allsubsets(set, sub, n, index+1);
  10. }
RAW Paste Data