PERMUTATIONS AND STACKS.

Question 4

OK, the scenario is this: supposing you've got three stacks. The first stack has the numbers 1, 2, 3 on it in order from top-to-bottom (ie, the first number you can pop off the stack is 1, then 2, then 3). The second and third stacks are empty.

You're allowed two kinds of moves. You can either pop a number off the first stack and push it onto the second stack, or pop a number off the second stack and push it onto the third stack. "Backwards" moves are not allowed. You have to move all the numbers from the first stack to the third.

4. Supposing you start with the numbers 1,2,3,4 on the first stack. How many arrangements can you make on the third stack?

Solution

You can make 14 combinations.


Press this button to calculate obtainable permutations of n numbers using s stacks: