长话短说,我的讲师很垃圾,通过投影仪向我们展示了前缀堆栈的中缀,他的大黑影挡住了一切,所以我错过了重要的东西
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
他指的是push和pop,push = 0 pop = x
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)
步骤 1 反向:)1-4(*5+)1-2(/3*2
好的,我可以看到
step 1 Reverse : )1-4(*5+)1-2(/3*2
ok i can see that
然后他继续写 x 和 o 的操作,我完全迷路了
he then went on writing x's and o's operations and i got totally lost
回答14-5*12-32*/+
然后再反过来得到+/*23-21*5-41
answer 14-5*12-32*/+
then reversed again to get +/*23-21*5-41
如果有人可以向我解释 push pop 以便我能理解,我会非常感激,我在网上看过但我发现的很多东西似乎比这更重要,所以我真的需要先了解一下
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
希望这将帮助您可视化 Stack 及其工作原理.
Hopefully this will help you visualize a Stack, and how it works.
空栈:
| |
| |
| |
-------
Push A
后,得到:
| |
| |
| A |
-------
Push B
后,得到:
| |
| B |
| A |
-------
弹出后,你得到:
| |
| |
| A |
-------
Push C
后,得到:
| |
| C |
| A |
-------
弹出后,你得到:
| |
| |
| A |
-------
弹出后,你得到:
| |
| |
| |
-------