Question

I'm struggling getting the pseudo code for this.

Scan string left to right for each char If operand add it to string Else if operator add to stack ....

i'm struggling on how to handle ( )s

OTHER TIPS

( goes on to the stack, then when you get to ) you pop from the stack until you find a (.

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

I am a bit rusty at this, but when you encounter a '(' , you push it onto the stack because it has the highest precedence. I cant remember what to do when you encounter ')', but i think it goes on the stack as well because its the highest precedence.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top