Advertisements
Advertisements
प्रश्न
Write an algorithm to evaluate a postfix expression.
लघु उत्तरीय
Advertisements
उत्तर
- Start.
- Create an empty stack.
- Scan the postfix expression from left to right.
- If the symbol is an operand, push it onto the stack.
- If the symbol is an operator, pop the required operands.
- Apply the operator in the correct order and push the result.
- After scanning all symbols, the top element is the result.
- Stop.
shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
