Re: Converting postfix, infix, prefix and binary trees in one program
Posted 19 September 2009 - 07:56 AM
Do you have any code already written? All I see is your username in your code tags.
You don't provide a detailed explanation for what you what, but it sounds like you want to use a binary tree structure to store an equation and then convert it between prefix, infix, and postfix forms. Is this right?
A binary tree is a tree data structure that has, at most, two children. It could also have just one or zero children. This is usually implemented with a struct that has data for the value stored at that node, and pointers to the child nodes. To store an equation in a tree, you will store the operator (+ - * /) in the parent and the two children will be the operands.