c - Generating all permutations of pairs excluding permutations of individual elements -


I would like to generate all the permutations of sequential combinations (a, b) where a! = B, and a, b are the elements of S (let S: = {1..k}), but excluding the variation of the individual elements of S.

For example, setting k = 2, (1, 2), (2, 1) , 1), (1, 2)

But in reality, {1-> 2, 2-> 1} are duplicated under permutation mapping. For

k = 3, there are 6 possible orders added, 6 will be given! Sequence (with duplicates) but with 3! = Possible permutations, the desired number of unique scenes 5! , And sequences starting with only pair (1, 2) are easily generated.

In the general case, give * (k-1) pairs, [k * (k-1)]! Sequence (with duplicates), and K will be! Permutations, so I should end with [k * (k-1)]! / Kashmir! Sequence

I intend to use only the small values ​​of K, but I am thinking that there are some good ways to create these scenes. I am doing a lot of things. It is a specific sort of filtering of specific sequences. The matter is (allowing duplicate elements) under those permutations of potential elements in those sequences, but there is probably something I see that it is easier than animals - all Creating Nbavit scenes and compelling approach to filtering.

I think that you can only increase your view of the sequence which is sequence (1,2 ) Starts with only the sequence if you consider each digit in return:

  1. The digits match the previous digit
  2. The points next unseen points < So a sequence (1,2) (2,1) and (1,2) (3,4) would be allowed, but not (1,2) (4,5) Because 4 violates the rules (3) S)

    Looking at this, you can again combine each combination with all the combinations, where each pair should be both a new pair, and a satisfied rule.

    for example = 3

      (1,2) for level 1 (1,2) only after option (2,1) or (1 , 3) or (2,3) or (3,1) or (3,2) (1,2) (2,1) after (3,1) or (3,2) or (1,3) Or can be followed by (2,3) (3) 1,2) (2,1) (3,1) ...  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -