Solved

# question about push and pop and stacks (very URGENT)

Posted on 2004-11-12

Hi,

I have a question about stacks, push, and pop, related to postfix and prefix notation. Say I have a the postfix notation of abc x+ and the reverse Polish prefix of cb x a +. Right now I have the stacks like this:

Prefix Postfix

c +

b x

x c

a b

+ a

Am I stacking these correctly? With the pre-fix I'm stack LIFO (I think) and the post-fix FILO (first in last out). Sorry if this is confusing. What I basically want to know is if the stacking method is correct and if there is anything from having both stacks be LIFO or FILO. Or put another way, how do you know how to stack a problem like this? The infix notation of this is a+ (bxc) if this helps any. I hope this makes some kind of sense. If all is lost hopefully someone can explain stacks to me and push and pop.

Thanks

Angela