From: Mok-Kong Shen on

Permutations of n different objects can be ordered and thus mapped to
numbers. There are good algorithms for doing the conversions. See

http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms

If there are only two kinds of objects (say, black and white), with n
even and n/2 objects of each kind, are there good algorithms of doing
the same?

Thanks,

M. K. Shen

From: Patricia Shanahan on
Mok-Kong Shen wrote:
>
> Permutations of n different objects can be ordered and thus mapped to
> numbers. There are good algorithms for doing the conversions. See
>
> http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms
>
>
> If there are only two kinds of objects (say, black and white), with n
> even and n/2 objects of each kind, are there good algorithms of doing
> the same?

This is equivalent to the problem of specifying a set of n/2 unique
numbers each in the range from 1 through n. Regard the selected set as
the index values for the black elements. Any index not in the set gets a
white element.

There are n choices for the first number, n-1 choices for the second
one, ..., 1+n/2 choices for the last of the n/2 selected numbers.

Patricia
From: Mok-Kong Shen on
Patricia Shanahan wrote:
> Mok-Kong Shen wrote:
>>
>> Permutations of n different objects can be ordered and thus mapped to
>> numbers. There are good algorithms for doing the conversions. See
>>
>> http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms
>>
>>
>> If there are only two kinds of objects (say, black and white), with n
>> even and n/2 objects of each kind, are there good algorithms of doing
>> the same?
>
> This is equivalent to the problem of specifying a set of n/2 unique
> numbers each in the range from 1 through n. Regard the selected set as
> the index values for the black elements. Any index not in the set gets a
> white element.
>
> There are n choices for the first number, n-1 choices for the second
> one, ..., 1+n/2 choices for the last of the n/2 selected numbers.

Sorry for my poor knowledge, I don't yet quite understand you. For
exalmple, with n=3 (and 1/0 for black/white), how does the entire
ordering look like (giving a part of it is sufficient) and how does
one compute, e.g. the index for 0 1 1 0 0 1?

Thanks in advance.

M. K. Shen
From: Patricia Shanahan on
Mok-Kong Shen wrote:
> Patricia Shanahan wrote:
>> Mok-Kong Shen wrote:
>>>
>>> Permutations of n different objects can be ordered and thus mapped to
>>> numbers. There are good algorithms for doing the conversions. See
>>>
>>> http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms
>>>
>>>
>>>
>>> If there are only two kinds of objects (say, black and white), with n
>>> even and n/2 objects of each kind, are there good algorithms of doing
>>> the same?
>>
>> This is equivalent to the problem of specifying a set of n/2 unique
>> numbers each in the range from 1 through n. Regard the selected set as
>> the index values for the black elements. Any index not in the set gets a
>> white element.
>>
>> There are n choices for the first number, n-1 choices for the second
>> one, ..., 1+n/2 choices for the last of the n/2 selected numbers.
>
> Sorry for my poor knowledge, I don't yet quite understand you. For
> exalmple, with n=3 (and 1/0 for black/white), how does the entire
> ordering look like (giving a part of it is sufficient) and how does
> one compute, e.g. the index for 0 1 1 0 0 1?

Sorry, I should have been clearer. I'm not giving a complete solution,
just an idea for an approach that might work, when combined with ideas
from the link you posted.

Patricia
From: Mok-Kong Shen on
Patricia Shanahan wrote:
> Mok-Kong Shen wrote:
>> Patricia Shanahan wrote:
>>> Mok-Kong Shen wrote:
>>>>
>>>> Permutations of n different objects can be ordered and thus mapped to
>>>> numbers. There are good algorithms for doing the conversions. See
>>>>
>>>> http://stackoverflow.com/questions/1506078/fast-permutation-number-permutation-mapping-algorithms
>>>>
>>>>
>>>>
>>>> If there are only two kinds of objects (say, black and white), with n
>>>> even and n/2 objects of each kind, are there good algorithms of doing
>>>> the same?
>>>
>>> This is equivalent to the problem of specifying a set of n/2 unique
>>> numbers each in the range from 1 through n. Regard the selected set as
>>> the index values for the black elements. Any index not in the set gets a
>>> white element.
>>>
>>> There are n choices for the first number, n-1 choices for the second
>>> one, ..., 1+n/2 choices for the last of the n/2 selected numbers.
>>
>> Sorry for my poor knowledge, I don't yet quite understand you. For
>> exalmple, with n=3 (and 1/0 for black/white), how does the entire
>> ordering look like (giving a part of it is sufficient) and how does
>> one compute, e.g. the index for 0 1 1 0 0 1?
>
> Sorry, I should have been clearer. I'm not giving a complete solution,
> just an idea for an approach that might work, when combined with ideas
> from the link you posted.

I am clueless and should appreciate it, if someone could kindly give
me a bit more help.

M. K. Shen