| Author |
Deranged permutations
|
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
|
|
For a 2 element list with 2 distinct elements [0, 1] a permutation exists where there all elements are in a different position than the original list. We can say that the maximum "derangement" of the list is 2
For a 3 element list with 2 distinct elements [0, 1, 1] every permutation has at least one element that is in the same position in the permuted list as the original list. The maximum derangement of this list is also 2.
Is there a formula for the generalization of this observation. i.e. for an M element list with N distinct elements (where N <= M) the maximum possible derangement of a permutation of that list is X?
I've tried googling, but I can't come up with the right keywords, and the math quickly goes over my head.
|
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 13842
|
|
It can't just be a function of M and N, because (up to isomorphism) there are two different 4-element lists with 2 distinct elements, namely [0, 0, 1, 1] and [0, 1, 1, 1].
And they have different maximum derangements: the first's MD is 4 and the second's is 2.
In general for a list with K zeroes and L ones, where K <= L, the maximum derangement is 2K, unless I'm missing something. But extending that to 3 or more distinct elements isn't nearly as obvious, although I haven't spent any time poking at it.
|
 |
Garrett Rowe
Ranch Hand
Joined: Jan 17, 2006
Posts: 1295
|
|
Paul Clapham wrote:It can't just be a function of M and N, because (up to isomorphism) there are two different 4-element lists with 2 distinct elements, namely [0, 0, 1, 1] and [0, 1, 1, 1].
And they have different maximum derangements: the first's MD is 4 and the second's is 2.
Good point. I hadn't thought that through.
In general for a list with K zeroes and L ones, where K <= L, the maximum derangement is 2K, unless I'm missing something. But extending that to 3 or more distinct elements isn't nearly as obvious, although I haven't spent any time poking at it.
Unfortunately the problem I was trying to solve might be a bit more difficult. I was looking at the Best Shuffle problem on Rosetta Code and trying to figure out if there is an algorithm for deciding ahead of time the maximum deraingement of the target word. You could then theoretically continuously random shuffle and check until you came up with a permutation with maximum derangement,
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 13842
|
|
Garrett Rowe wrote:Unfortunately the problem I was trying to solve might be a bit more difficult.
It might, or it might not. It might depart from the triviality of the case I already analyzed in a linear way, or it might turn out to be more like calculating the number of partitions of an integer. My spidey math sense is leaning towards the latter but I wouldn't bet big money on either outcome at this point in time.
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 8428
|
|
Garrett Rowe wrote:
For a 3 element list with 2 distinct elements [0, 1, 1] every permutation has at least one element that is in the same position in the permuted list as the original list. The maximum derangement of this list is also 2.
maybe i'm slow...why is the derrangement 2? If there is no permutation where all the elements are different, why wouldn't it be 1?
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 13842
|
|
|
Lines 01 and 02 differ in the first two positions, so their "derangement" is two, for example.
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 8428
|
|
ah...thanks. it's not the number of different arrangements with all elements moved, but how many elements are in a different position for each permutation, then the maximum of those...
thanks
|
 |
 |
|
|
subject: Deranged permutations
|
|
|