Skip to content

Instantly share code, notes, and snippets.

@Khalefa
Created September 24, 2018 22:49
Show Gist options
  • Save Khalefa/d2807e300470a9e8d431215a27838086 to your computer and use it in GitHub Desktop.
Save Khalefa/d2807e300470a9e8d431215a27838086 to your computer and use it in GitHub Desktop.
permutations
#include <vector>
#include <iostream>
#include <string>
using namespace std;
vector< vector<string>> params;
void all_permutation(vector<vector<string>> &p, string &&x, int i) {
if (i >= p.size()) {
cout << x << endl;
return;
}
for (int j = 0; j<p[i].size(); j++) {
all_permutation(p, x + p[i][j] + " ", i + 1);
}
}
int main() {
vector<string> param0 = { "quick","shell", "insertion", "radix" };
vector<string> param1 = { "100000","250000", "500000", "1000000","2000000","10000000" };
vector<string> param2 = { "1","2", "3" };
vector<string> param3 = { "16","128","1000" };
vector<string> param4 = { "as", "r","ds" };
params.push_back(param0);
params.push_back(param1);
params.push_back(param2);
params.push_back(param3);
params.push_back(param4);
all_permutation(params, " run ", 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment