Which data structure is most suitable for evaluating a postfix expression?
Options
- A. Queue
- B. Stack
- C. Circular Queue
- D. More than one of the above
- E. None of the above
Quiz Practice:
B. Stack
A stack is used to evaluate a postfix expression because operands must be temporarily stored until an operator is encountered. When an operator appears, the required operands are removed from the top of the stack, the operation is performed, and the result is pushed back. Stack follows LIFO, making it suitable for expression evaluation, recursion, parentheses matching, and infix-to-postfix conversion.