A computer science professor has 7 different programming books on a bookshelf. 3 of the books deal with c++, the other 4 with Java. In how many ways can the professor arrange these books on the shelf if all the c++ books must be next to each other?
Is there a formula for this?
treat the c++ books as one unit.
then you will have five books
the number of arrangements for these is 5 x 4 x 3 x 2 x1
but the c++ books can arrange themselves in 3 x 2 x 1 ways
total number of ways = 5! x 3! = 720