Skip to main content
GameDev.net gamedev.net
🔒 Locked

binary trees and arithmetic expressions

Started by Tai-Pan May 9, 2003 at 6:28 PM 1 replies 200+ views
Original Post
Tai-Pan
Tai-Pan
I have to write some code that makes an "arithmetic expression binary tree" from another arithmetic expression in posfix. I mean..I have the posfix expression, and I need to create the binary tree that contains all the operands and operators. I know that there is a logical method to do this..but Ive been trying to do this for days and I cant make the thing work as it should. Any help?! Thank you guys "Those who follow the path of the warrior must be ready to die, to stand for their convictions, live for one´s convictions, die for one´s convictions"
"Those who follow the path of the warrior must be ready to die, to stand for their convictions, live for one´s convictions, die for one´s convictions"
JohnBolton
JohnBolton
Use a stack. And that''s all I''ll say.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Tai-Pan
Tai-Pan
Thanks Jambolo..but I already know that...The problem is that I dont know the correct logic/order to insert the different trees in the stack and when to pop the..Do you know where can I take a look at some code?

"Those who follow the path of the warrior must be ready to die, to stand for their convictions, live for one´s convictions, die for one´s convictions"
"Those who follow the path of the warrior must be ready to die, to stand for their convictions, live for one´s convictions, die for one´s convictions"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.