I'm needing to evaluate string infix equations and transform them to postfix equations.
I'm following the info here: http://scriptasylum.com/tutorials/infix_postfix/algorithms/infix-postfix/index.htm
1.) I'm confused by this line: "compare the precedence of the character with the element on top of the stack"
It's asking me to compare the precedence of an operand to an operator. I'm not sure what it means by that. I can understand the idea of precedence between two operators, but not between an operator and an operand.
2). I'm needing to identify whether or not each character from a string is an operator or not. (+, -, *, etc.) In addition to those, I'm also needing to deal with parentheses in the equations.
I used Character.isLetter(character) and Character.isDigit(character) to determine if each character of the string is a letter or number (operands), so I'm wondering if there is a shortcut like that I can use instead of having to test each character of the string against each individual possible operator...
Tips are appreciated! :)
Edited 7 Years Ago by nola_Coder: n/a