|
-
Infix to Postfix
I need help how do i write this program using these guidlines:
Let postfix be an empty String and stack be an empty Stack
For each token in the input stream
{
if operand: Immediately concatenate operand to postfix
if open parentheses: Push "(" on the stack
if close parentheses: Pop stack symbols and attach to postfix until getTop is an open parentheses, then pop "("
if operator: While the stack is not empty, pop all operators as long as they are of equal or higher
precedence and the top is not "(". Concatenate each operator from stack to postfix.
Then push the current operator.
}
I need to write code on converting infix to postfix, the above algorithm would convert infix to postfix. I need to know how to do this using this algorithm that was given to me. Or can anyone direct me to a site that could possibly have this code thank you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks