Inverse Permutation Question in c++ 2011-12View more random threads:
- classes use in c++ May 2011
- But "cin" lines are not producing the results 2011
- int x[10]; x[0]= 1; x[1]=2; if following code is executable...
- adding rows and columns of a multi array in c++ 2011
- why we use member intilizer list.what is benefit of using...
- Vector of stucts in c++ 2011-12
- Read data from file into arrays in c++ 2011
- what is main logic behind turning a register into byte...
- Is there Any difference b/w Object Oriented ProgrAmming And...
- need some guidece for those students those are new in...
Inverse permutations from an array of permutations. It's my first time coding on permutations so I don't have any experience on this. So I came up with a solution to just swap the array and the element number as the inverted permutation
Sponsored Links
vCode:oid inverse ( unsigned ip[], const unsigned p[], unsigned elements ) { unsigned tempArray = 0, tempIndex = 0; for (int i = 0; i < elements; i++ ) { tempIndex = i; tempArray = p[i]; ip[tempArray] = tempIndex; } show ( ip, 5 ); }
There are currently 1 users browsing this thread. (0 members and 1 guests)