मराठी

Convert the following infix notations to postfix notations, showing stack and string contents at following step. A + B - C * D - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

Convert the following infix notations to postfix notations, showing stack and string contents at following step.

A + B - C * D

थोडक्यात उत्तर

उत्तर

Infix Expression is : A + B - C * D

Scanning from Left to Right

Symbol Action Stack, Initially Stack is Empty [ ] Postfix Expressions
A Append to Postfix Expression [ ] A
+ PUSH(‘+’)  + A
B Append to Postfix Expression + A B
– have equal precedence to +. First POP(‘+’) then PUSH(‘-‘)  – A B +
C Append to Postfix Expression A B + C
* * have higher precedence than -, PUSH ‘*’ – * A B + C
D Append to Postfix Expression – * A B + C D
End of Expression POP all and add to Postfix Expression [ ] A B + C D * –
Postfix Expression is : A B + C D * –
shaalaa.com
Conversion from Infix to Postfix Notation
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 3: Stack - Exercise [पृष्ठ ५२]

APPEARS IN

एनसीईआरटी Computer Science [English] Class 12
पाठ 3 Stack
Exercise | Q 6. a) | पृष्ठ ५२
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×