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 algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to