Week 7 Data Structures.

Dom
Invisible College
Published in
1 min readMar 10, 2015

A stack can be used to ensure that an arithmetic expression has balanced parentheses. Write a function that takes an arithmetic expression as an argument and returns the position in the expression where a parenthesis is missing. An example of an arithmetic expression with unbalanced parentheses is 2.3 + 23 / 12 + (3.14159* .24.

A postfix expression evaluator works on arithmetic expressions taking the following form:

op1 op2 operator

Using two stacks — one for the operands and one for the operators — design and implement a JavaScript function that converts infix expressions to postfix expressions, and then use the stacks to evaluate the expression.

--

--

Dom
Invisible College

Student of The one and only Invisible College