It seems a simple problem, yet...
Applying a permutation to a vector, part 1
by Raymond Chen
From the article:
Suppose you have a vector indices of N integers that is a permutation of the numbers 0 through N − 1. Suppose you also have a vector v of N objects. The mission is to apply the permutation to the vector. If we let v2 represent the contents of the vector at the end of the operation, the requirement is that v2[i] = v[indices[i]] for all i...
Add a Comment
Comments are closed.