Manually calculated it to be 14.. [?] Can't think of any general formula but i think a formula or at least recursive function must be there to solve this.
On Sat, Jun 4, 2011 at 1:01 PM, siva viknesh <[email protected]> wrote: > Stack A has the entries a,b,c ( with a on the TOp) Stack B is empty. > an entry pooped out of the stack A can be printed immediatly or pushed > to stack B. An Entry popped out of the stack B can only be printed. In > this Arrangement ,if Stack A has 4 entries, then number of possible > permutation will be > > (a) 24 (b) 12 (c) 21 (d) 14 > > > for 3 entries ..solution is 5.....abc,cba,bac,bca,acb....(except > cab)..its like 3! - 1 (n! - 1 for n=3) > > ..is there any easy way to find for 4 entries ???...also what is the > general solution ?? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
<<330.gif>>
