Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. vector<string> permutations;
  2. bool used[SIZE];
  3. string v[SIZE];
  4.  
  5. void generate_permutations(int x) {
  6.     if (x == SIZE) {
  7.         // esegui operazioni sulla permutazione
  8.         return
  9.     }
  10.     for (int i = 0; i < SIZE; i++) {
  11.         if (used[i]) continue;
  12.         permutations.push_back(v[i]);
  13.         used[i] = true;
  14.         generate_permutations(x + 1);
  15.         used[i] = false;
  16.         permutations.pop_back();
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement