हिंदी

Write an algorithm to convert infix to postfix.

Advertisements
Advertisements

प्रश्न

Write an algorithm to convert infix to postfix.

लघु उत्तरीय
Advertisements

उत्तर

  1. Start.
  2. Create an empty operator stack and an empty output list.
  3. Scan the infix expression from left to right.
  4. Add operands directly to the output.
  5. Push a left parenthesis onto the stack.
  6. For a right parenthesis, pop operators to the output until the left parenthesis is found; then remove it.
  7. For an operator, pop operators having higher or equal precedence, then push the incoming operator.
  8. Pop all remaining operators to the output.
  9. 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 19. | पृष्ठ १२३
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×