0

Given a word "aab", permutations are:

aab, aab, aba, aba, baa, baa

I need to get the number of permutations where characters don't repeat. So from the above permutations, I need to ignore those which has consecutive characters. So, I need to the result to be 2 which is (aba, aba).

How can I achieve this?

Another example: given word "aabb", I need to achieve 8 which is:

abab, abab, abab, abab, baba, baba, baba, baba

Placid
  • 103
  • 2

1 Answers1

0

Let's try the example with four characters first, then you can try and see if you can mimic it for three characters.

You have "aabb" that you want to distribute into "_ _ _ _", two cases: one starting with $a$ another starting with $b$.

Case 1: Starting with $a$. This means that you have $2! \cdot 2! \cdot 1! \cdot 1! = 4$ way of permuting the characters.

Let's reason why this is the case. The first place can be one of two $a$'s available. So that's $2!$ ways of choosing it. Then the second place needs to be a $b$, which again you have two of, so $2!$ ways of putting a $b$ there. Then the third and fourth places, you've only got $1$ $a$ and $1$ $b$ left, so they both have $1!$ ways of being put there.

Case 2: Starting with $b$. This means you have $2!\cdot 2!\cdot 1!\cdot 1! = 4$ ways of permuting the characters.

In total, this means you have $4 +4 = 8$ ways of permuting them. Although, really, with experience, you're going to notice that splitting them into cases doesn't really matter, you could have simply exploited the symmetry present.

Zain Patel
  • 16,802
  • Hi @Zain, thank you so much for the clear explanation. Is it possible to build a formula to achieve the final result? Thanks again. – Placid Jul 21 '15 at 10:14
  • It depends on what the final result is, I'm not sure what you want it to be. $a^nb^n$ letters? – Zain Patel Jul 21 '15 at 10:20