Pseudocode for converting infix to postfix

I am trying to get pseudo code for this.

Scan the string from left to right for each char If the operand adds it to the string Otherwise, if the operator adds to the stack ....

I am struggling on how to handle () s

+2


source to share


3 answers


+1


source


I'm a little rusty, but when you come across '(' you push it onto the stack because it has the highest priority. I can't remember what to do when you come across ')' but I think it goes to stack because it has the highest priority.



0


source


(

goes onto the stack and then when you get to )

, you pop off the stack until you find (

.

Wikipedia has a more detailed description of the algorithm, the supporting functions, and the operators.

0


source







All Articles