wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Infix to postfix algorithm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Infix to postfix algorithm" Watch "Infix to postfix algorithm" New topic
Author

Infix to postfix algorithm

Torvald Helmer
Greenhorn

Joined: Oct 26, 2005
Posts: 8
I need help to finish my agorithm!
This is what I have so far:



In the "help wanted" else-loop I want to do the following:

The operator from stack should pop, and
it must be compared with the next operator
from the infix-expression, in according to the
priority which is given in the opPri, infixPri and opStackPri.
The if the infix-operator has a higher priority then I push it
to the stack, else the stack-operator pops and are added
to the postfix-string, and the next stack operator is popped and
compared with the same infix-operator. Then again if the infix has
a higher value I push it to the stack, else the stack-operator is popped
and added. So on and so on...

And it's only supposed to handle one digits numbers.

As you see, I know how it should function, but I am not sure at all
about the syntax. Can anyone please help me with this?

thanks!

torvald helmer
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Hi,

Welcome to JavaRanch!

Please post your questions to one and only one forum. See here for an explanation. I've deleted the other two copies of this that you posted.


[Jess in Action][AskingGoodQuestions]
 
 
subject: Infix to postfix algorithm
 
Similar Threads
A continuation of my previous post, if I may...
help with project please
Compare operators
infix to postfix, need help catching errors such as having extra parenthesis
Converting Infix to Postfix Expressions