Advertisements
Advertisements
प्रश्न
Convert the following infix notations to postfix notations, showing stack and string contents at following step.
A * ((C + D)/E)
थोडक्यात उत्तर
Advertisements
उत्तर
Infix Expression is : A * ((C + D)/E)
Scanning from Left to Right
| Symbol | Action | Stack, Initially Stack is Empty [ ] | Postfix Expressions |
| A | Append to Postfix Expression | [ ] | A |
| * | PUSH ‘*’ | * | A |
| ( | PUSH ‘(‘ | * ( | A |
| ( | PUSH ‘(‘ | * ( ( – | A |
| C | Append to Postfix Expression | -* ( ( | A C |
| + | PUSH ‘+’ | – * ( ( + | A C |
| D | Append to Postfix Expression | – * ( ( + | A C D |
| ) | POP till one opening bracket is popped, add popped operator to expression | – * ( | A C D + |
| / | PUSH ‘/’ | – * ( / | A C D + |
| E | Append to Postfix Expression | – * ( / | A C D + E |
| ) | POP till one opening bracket is popped, add popped operator to expression | – * | A C D + E / |
| End of Expression | POP all and add to Postfix Expression | [ ] | A C D + E / * – |
shaalaa.com
Conversion from Infix to Postfix Notation
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
