Pipelining
November 12, 2023Database-Management-System
November 12, 2023GATE 2004
Question 5 |
The best data structure to check whether an arithmetic expression has balanced parentheses is a
queue | |
stack | |
tree | |
list |
Question 5 Explanation:
Stack is the best data structure to validate the arithmetic expression.
While evaluating when left parentheses occur then it push in to the stack, when right parentheses occur pop from the stack.
While at the end there is empty in the stack.
While evaluating when left parentheses occur then it push in to the stack, when right parentheses occur pop from the stack.
While at the end there is empty in the stack.
Correct Answer: B
Question 5 Explanation:
Stack is the best data structure to validate the arithmetic expression.
While evaluating when left parentheses occur then it push in to the stack, when right parentheses occur pop from the stack.
While at the end there is empty in the stack.
While evaluating when left parentheses occur then it push in to the stack, when right parentheses occur pop from the stack.
While at the end there is empty in the stack.