AlHal2
asked on
Splitting a Sequence and counting combinations
Suppose I have a sequence of N numbers a1,a2,...an.
a1 is repeated b1 times
a2 is repeated b2 times.
I want to split the total sequence of N numbers into 2 separate sequences of N/2 numbers where the order does not matter.
The user does not care if they an a1 or an a2 ...or an an.
For example suppose the sequence is 111122223333 which has 12 characters.
I can split it into several sequences of 6 characters for example
112233
122223
123333
What is the formula for determining how many combinations there are of 6 characters?
a1 is repeated b1 times
a2 is repeated b2 times.
I want to split the total sequence of N numbers into 2 separate sequences of N/2 numbers where the order does not matter.
The user does not care if they an a1 or an a2 ...or an an.
For example suppose the sequence is 111122223333 which has 12 characters.
I can split it into several sequences of 6 characters for example
112233
122223
123333
What is the formula for determining how many combinations there are of 6 characters?
do you have to have at least one of each type?
ie is 222333 aceptable?
ie is 222333 aceptable?
ASKER
222333 is acceptable.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I want to do this programmatically. Is there a formula?
ASKER
Thanks. I'll work on the programming bit myself.
As You can see with even your nice numbers for b's, there are min and Max functions in the above process .
As you try to generalize , the number of edge cases will grow and you will have to have even more min and Max functions to handle those cases.
As you try to generalize , the number of edge cases will grow and you will have to have even more min and Max functions to handle those cases.
ASKER