हिंदी

Write an algorithm to evaluate a postfix expression.

Advertisements
Advertisements

प्रश्न

Write an algorithm to evaluate a postfix expression.

लघु उत्तरीय
Advertisements

उत्तर

  1. Start.
  2. Create an empty stack.
  3. Scan the postfix expression from left to right.
  4. If the symbol is an operand, push it onto the stack.
  5. If the symbol is an operator, pop the required operands.
  6. Apply the operator in the correct order and push the result.
  7. After scanning all symbols, the top element is the result.
  8. Stop.
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 6: Stacks & Queues in list - EXERCISE [पृष्ठ १२३]

APPEARS IN

सीबीएसई Computer Science with Python [English] Class 12
अध्याय 6 Stacks & Queues in list
EXERCISE | Q 18. | पृष्ठ १२३
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×