-
The best data structure to check whether an arithmetic expression has balanced parenthesis is a
-
- queue
- stack
- tree
- list
- queue
Correct Option: B
Balanced parenthesis in an equation are such that the no. of opening and closing parenthesis and in correct order should be there. We can check balancing using stack. When we get any opening parenthesis, then we push that in the stack & if we get a closing one, then we pop the stack. After the complete scanning of input string if stack is found empty then the arithmetic expression is balanced.