Let we have 4 boys and 4 girls and we need to arrange them, with no two boys and no two girls are next to each other? Let place first the boys
b b b b
the 4 boys can arrange themselves by 4! ways. Now we have 5 positions between boys but we have 4 girls. If we arrange them like $5^{P}4 = 5!$ then the total arrangement will be = $5! \times 4!$
But there is a problem,
If we think, g b g b g b (*) b
In the above style we have a boy and boy repetition. How to solve this problem?