G
Gunnar G
Hello.
Given vector<double> x;
where I have no knowledge of the size of x at compile time, how can I write
code that will give me all the possible permutations of the elements in the
vector x?
For each permutation I get, I must temporarily save it in a vector and do
something with the vector, and then scrap it, and create the next
permutation.
How do I do this in an efficient way?
In the small case (the number of elements in x is small) it is possible to
store all permutations in a new vector, if that would be of any help.
Given vector<double> x;
where I have no knowledge of the size of x at compile time, how can I write
code that will give me all the possible permutations of the elements in the
vector x?
For each permutation I get, I must temporarily save it in a vector and do
something with the vector, and then scrap it, and create the next
permutation.
How do I do this in an efficient way?
In the small case (the number of elements in x is small) it is possible to
store all permutations in a new vector, if that would be of any help.