Is there is a easy way to make next_permutation to perform same set of swaps two different arrays of same size
for example
if i have two arrays a[]={1,2,3,4,5} and b[]={12,23,21,2,3}
if after permution 1 in array a goes to 3rd position then 12 in array b should also go to 3rd position.
Is there is a easy way to make next_permutation to perform same set of
Share
You can make an auxiliary index set:
Now perform the permutations on
indices, and then usea[indices[i]]andb[indices[i]].