Pergunta

I'm trying to optimize the permutations generated from a set of n elements.

Here is the pitch: I have a set of 6 elements $\{1,2,3,4,5,6\}$ and I want to create 10 permutations. I could use Heap algorithm to keep 10 among 6! possible combinations.

But I'd like to add specific constraint : I want to select the 10 permutations that minimize the number of elements at the same index. (avoid having 10 permutations with the 3 at the same index for example)

For instance, I simply create the first 6 permutations by rotating my initial set from 1 to 6 to the right to obtain the following combinations: $\{1,2,3,4,5,6\}$, $\{2,3,4,5,6,1\}$, $\{3,4,5,6,1,2\}$, $\{4,5,6,1,2,3\}$, $\{5,6,1,2,3,4\}$, $\{6,1,2,3,4,5\}$

Now, I would like to generate additional combinations following my constraint, do you have any clue or advice ?

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a cs.stackexchange
scroll top