हिंदी

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

Advertisements
Advertisements

प्रश्न

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

A * ((C + D)/E)

संक्षेप में उत्तर

उत्तर

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 / * –
Postfix Expression is : A C D + E / *
shaalaa.com
Conversion from Infix to Postfix Notation
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 3: Stack - Exercise [पृष्ठ ५२]

APPEARS IN

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

Englishहिंदीमराठी


      Forgot password?
Use app×