I'm struggeling with the following problem in Python. The problem is more like math specific than Python specific.
I've got a number of N books as a Stack. And a number of P stacks to split on.
I'm looking for the possibilites to split this stack, avoiding repetitions and empty stacks.
So let's say my stack is 4 books tall, what are the possibilities to split on 2 stacks ?
The possibilities to split would be:
(1,3)
(2,2)
There would also be the possibility of (3,1), but since (1,3) is already in my output, I don't want (3,1) to be there too.
Another example:
5 books, 3 stacks
(3,1,1)
(2,2,1)
Solutions like (1,1,3), (2,1,2) are not in my output beacause they are redundant.
Im looking for an EFFICIENT way to compute the tuples of stacks. I'm working with a starting stack sizes up to 400, this stack could be split into another stack, which could also be split and so on.
Is there already a reference which covers this problem?
I think it would be easy to solve in combinatoric terms, but the problem here is, I am interested in the Possibilities themself and not just the number of possibilities !
Any help here?
cheers