1985 All American 2175 Posts user info edit post |
I'm trying to do this in matlab, but if you can do it in any language, that'd be great.
I need to know how to find all permutations of a set, count the number of transpositions it took to get that particular permutation, and list each pair of permuted elements. . . ie. for the permutation (x3,x2,x1) of (x1,x2,x3), i need 3 transpositions (x1 switches with x2), (x1 switches with x3) and (x3 switches with x2) and the pairs would then be x1x2, x1x3 and x2x3...
If anyone could help me come up with some algorithm, that'd be great. 1/8/2007 12:19:41 PM |