COMPUTER SCIENCE AND ENGINEERING
DATA STRUCTURES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
operands
|
|
operators
|
|
operators and opening symbols
|
|
operators and operands
|
|
stack is not used for this evaluation
|
Detailed explanation-1: -While reading the expression from left to right, push the element in the stack if it is an operand. Pop the two operands from the stack, if the element is an operator and then evaluate it. Push back the result of the evaluation. Repeat it till the end of the expression.
Detailed explanation-2: -1. The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is? = 350.
Detailed explanation-3: -Step 1: Create an operand stack. Step 2: If the character is an operand, push it to the operand stack. Step 3: If the character is an operator, pop two operands from the stack, operate and push the result back to the stack. Step 4:After the entire expression has been traversed, pop the final result from the stack.