...
Pipelining
November 12, 2023
Database-Management-System
November 12, 2023
Pipelining
November 12, 2023
Database-Management-System
November 12, 2023

GATE 2004

Question 5

The best data structure to check whether an arithmetic expression has balanced parentheses is a

A
queue
B
stack
C
tree
D
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.
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.

Leave a Reply

Your email address will not be published. Required fields are marked *