07-23-2003, 09:40 AM
LOL. Try read that from my point of view.
"This is bettar!"
"What is rpn?"
You cant claim yours is better without knowing what he means, can you :S.
RPN is reversed polish notation. It is an extremely simplified format for displaying mathematical expressions
i.e.
infix:
5 * (3 + 4)
postfix (RPN):
3 4 + 5 *
There is no brackets (no need for recursion), and no order of operation . You just scan from left to right and its damn easy to parse it.
push 3
push 4
pop a '4
pop b '3
push a + b '7
push 5
pop a '5
pop b '7
push a * b '35
the top of your stack is now the answer. However, the only trouble is converting from infix to postfix (RPN) notation. Im still trying to figure out myself how i should be going about how to do this.
:???: I hope i didnt make much mistakes in there.
"This is bettar!"
"What is rpn?"
You cant claim yours is better without knowing what he means, can you :S.
RPN is reversed polish notation. It is an extremely simplified format for displaying mathematical expressions
i.e.
infix:
5 * (3 + 4)
postfix (RPN):
3 4 + 5 *
There is no brackets (no need for recursion), and no order of operation . You just scan from left to right and its damn easy to parse it.
push 3
push 4
pop a '4
pop b '3
push a + b '7
push 5
pop a '5
pop b '7
push a * b '35
the top of your stack is now the answer. However, the only trouble is converting from infix to postfix (RPN) notation. Im still trying to figure out myself how i should be going about how to do this.
:???: I hope i didnt make much mistakes in there.