(3 + 4) - (1 * 2) + 1
precondition:Code:+ / \ - 1 / \ + * / \ / \ 3 4 1 2
The infix expression is being entered one character at a time.
The expression is FULLY parenthesized, like (6-4) or (3+(4-2)) or ((2-1)*6) or (((2+1)-4)^2)
Each node will consist of an operator (root) with two children or a digit with no children (BTW no digits ever have children obviously. Children of operators are either digits or a new subtree).
You can use pre-order and post-order traversal to output the tree in prefix and postfix, and use inorder traversal to evaluate the infix expression
My question is, how do I store the infix expression into a binary tree? I know how to do everything else