Q:

Arithmetic operations on arrays of string

In the textbox enter an expression (for example, 2 + 3-7).
With certain functions Split I divide the expression into two types String array where digits are stored in the first and second arithmetic signs.
a = {"2", "3", "7"}
b = {"+", "-"}
How to calculate this expression?

A:

Infix Notation: Operators are written between the operands they operate on, e.g. 3 + 4 .
Infix Expressions are harder for Computers to evaluate because of the addional work needed to decide precedence. Infix notation is how expressions are written and recognized by humans and, generally, input to programs. Given that they are harder to evaluate, they are generally converted to one of the two remaining forms. A very well known algorithm for converting an infix notation to a postfix notation is Shunting Yard Algorithm by Edgar Dijkstra. This algorithm takes as input an Infix Expression and produces a queue that has this expression converted to a postfix notation. Same algorithm can be modified so that it outputs result of evaluation of expression instead of a queue. Trick is using two stacks instead of one, one for operands and one for operators. 

For complete code refer - http://www.geeksforgeeks.org/expression-evaluation/

