View Single Post
 
Infix to Postfix
Reply
Posted 2007-03-26, 09:53 PM
Given the infix: ( 2 + 3 * 5 - ( 2 * 6 ^ 2 ) * 4 + ( ( 3 + 2 ) * 5 ) - 6 ) / 1

Could anyone check whether or not the following is the correct postfix?

2 3 5 * 2 6 2 ^ * 4 * 3 2 + 5 * + 6 - - + 1 /

In my testing phase that's what my program converted the infix to, and that's the same thing I got by hand, however evaluating the infix expression, both by hand and computer I get -252, yet both by computer and by hand I get -290 for the postfix expression. If someone could tell me whether or not I converted to postfix correctly I would greatly appreciate it, as it would help me isolate whether my evaluation method is incorrect or whether my conversion method is incorrect.
Old
Profile PM WWW Search
Demosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to beDemosthenes seldom sees opportunities until they cease to be
 
Demosthenes