long story short my lecturer is crap, and was showing us infix to prefix stacks via an overhead projector and his bigass shadow was blocking everything so i missed the important stuff
he was referring to push and pop, push = 0 pop = x
he gave an example but i cant see how he gets his answer at all,
2*3/(2-1)+5*(4-1)
step 1 Reverse : )1-4(*5+)1-2(/3*2
ok i can see that
he then went on writing x's and o's operations and i got totally lost
answer 14-5*12-32*/+
then reversed again to get +/*23-21*5-41
if some one could explain to me the push pop so i could understand i would be very greatful, i have looked online but alot stuff im finding seems to be a step above this, so i really need to get an understanding here first
Hopefully this will help you visualize a Stack, and how it works.
Empty Stack:
| |
| |
| |
-------
After Pushing A
, you get:
| |
| |
| A |
-------
After Pushing B
, you get:
| |
| B |
| A |
-------
After Popping, you get:
| |
| |
| A |
-------
After Pushing C
, you get:
| |
| C |
| A |
-------
After Popping, you get:
| |
| |
| A |
-------
After Popping, you get:
| |
| |
| |
-------