• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Infix to postfix algorithm

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic