How many ways are there to stack m piles with n items?

84 Views Asked by At

How the calculate the number of ways (permutation) of stacking m piles with n items?

Let's say I want 2 piles with 3 items: How to caluculates the permutations? A pile can consist of no item. What's to be considered is, that there are 2 places where an item can be placed. Legal combinations are:

o o    x o    o o    o x    
o x    x o    x o    o x    
x x    x o    x x    o x    

Not allowed is (Gravity needs to be considered):

x x
o o 
x o

I thought catalan numbers could help. But I can't find a way to use them.