Data Structures and Algorithms
Checking balanced delimiters in an infix algebraic expression using Stack
INSTRUCTIONS:
1. Use Java to implement your solution.
QUESTION:
Although programmers use parentheses when writing arithmetic expression in Java,
mathematicians use parentheses, square brackets, and braces for the same purpose. These
delimiters must be paired correctly. For example, an open parenthesis must correspond to a
close parenthesis. In addition, pairs delimiters must not intersect. Thus, an expression can
contain a sequence of delimiters such as
{[()()]()}
but not
[(])
For convenience, we will say that a balanced expression contains delimiters that are paired
correctly, or are balanced.
1. Design an algorithm to check for balanced delimiters in an infix algebraic expression.
2. Write a program that detects whether an infix expression is balance using stack
structure.
3. Test your program on a set of infix algebraic expression.