c++ generate permutations code example
Example: permutation c++
bool next_permutation(BidirectionalIterator first, BidirectionalIterator last);
bool prev_permutation(BidirectionalIterator first, BidirectionalIterator last);
//Example:
int a[]={1,2,3,4};
do {
for(auto& i : a) cout<<i<<" ";
cout<<endl;
} while (next_permutation(a,a+4));