Zelaron Gaming Forum

Zelaron Gaming Forum (http://zelaron.com/forum/index.php)
-   Tech Help (http://zelaron.com/forum/forumdisplay.php?f=329)
-   -   Infix to Postfix (http://zelaron.com/forum/showthread.php?t=42017)

Demosthenes 2007-03-26 09:53 PM

Infix to Postfix
 
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.

WetWired 2007-03-26 10:28 PM

Not that I claim to understand, but:
2 3 5 * 2 6 2 ^ * 4 * 3 2 + 5 * + 6 - - + 1 /
2 (3*5) 2 (6^2) * 4 * (3+2) 5 * + 6 - - + 1 /
2 (3*5) (2*(6^2)) 4 * ((3+2)*5) + 6 - - + 1 /
2 (3*5) ((2*(6^2))*4) ((3+2)*5) + 6 - - + 1 /
2 (3*5) (((2*(6^2))*4)+((3+2)*5)) 6 - - + 1 /
2 (3*5) ((((2*(6^2))*4)+((3+2)*5))-6) - + 1 /
2 ((3*5)-((((2*(6^2))*4)+((3+2)*5))-6)) + 1 /
(2+((3*5)-((((2*(6^2))*4)+((3+2)*5))-6))) 1 /
(2+((3*5)-((((2*(6^2))*4)+((3+2)*5))-6)))/1
(2+3*5-2*6^2*4+(3+2)*5-6)/1


All times are GMT -6. The time now is 01:51 PM.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
This site is best seen with your eyes open.