CodeRevisited Keep Learning.. Cheers!

Infix expression to Postfix expression

This post shows sample implementations for 1. Converting an infix expression to postfix expression (Reverse polish notation) 2. Evaluating postfix expression

Infix to PostFix notation

To convert from infix to postfix notation, I have implemented Dijkstra’s shunting-yard algorithm. For detailed algorithm, please take a look at wiki page.

Evaluating postfix expression

This program evaluates postfix expresions using a stack. The following is sample implementation in java

Sample code for Infix to PostFix

Sample code for PostFix evaluation

Check here for complete code.

For other libraries used in the above program, please refer to GitHub repo here