Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'm trying to solve a programming challenge, and I have narrowed down all the challenge to a combination/permutation problem.

I ended up with 5 possible scenarios, and I need to find all possible combinations in such scenarios, but I'm not really sure if my results or my line of thought is correct. I'd like to have some feedback on this matter.

Scenario 1:

an 11 elements long list that must arrange 1 A, and 10 B's in every possible way

Scenario 2:

a 12 elements long list that need to arrange 4 A's and 8 B's in every possible way

Scenario 3:

a 13 elements long list that need to arrange 7 A's and 6 B's in every possible way

Scenario 4:

a 14 elements long list that need to arrange 10 A's and 4 B's in every possible way

Scenario 5:

a 15 elements long list that need to arrange 13 A's and 2 B's in every possible way

e.g. For the first scenario I have 11 possible ways to arrange the list.

1.  A B B B B B B B B B B
2.  B A B B B B B B B B B
3.  B B A B B B B B B B B
4.  B B B A B B B B B B B
5.  B B B B A B B B B B B
6.  B B B B B A B B B B B
7.  B B B B B B A B B B B
8.  B B B B B B B A B B B
9.  B B B B B B B B A B B
10. B B B B B B B B B A B
11. B B B B B B B B B B A

For Scenario 2, I tried to do nCr(12,4) = 495

but I also thought a way to figure out the amount of combinations this way: since 4 slots must be A's and 8 slots must be B's 2^4 + 2^8 = 272

Chances are that both are wrong, but I've been working in this problem for about 4 hours straight and I can't think clearly.

Any help would be greatly appreciated!

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Your answer to 1 is correct, as it the 495 for 2. The same logic as for 2 (you have 12 slots and need to pick 4 for the B's) will handle the rest.

share|improve this answer
    
Thank you a lot for letting me know that 495 was correct for 2 :) –  AlanChavez Nov 15 '12 at 3:26

I usually proceed as follows (total ways)! divided by the repeats factorial

Example 3A and 4B and 6C = 13!/(3! x 4! x 6!)

your example no2 = 12!/(4! x 8!) = 495 no 3 = 13!/(7! x 6!) cheers

share|improve this answer
    
Yeah! that's the way to go about it! :-) –  mag Dec 3 '12 at 2:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.