Page 510 - Computer science 868 Class 12
P. 510

Right parenthesis )
                     pushed to stack                                                  V W Z * /
                                               )     Operators between right and
                                               *     left parenthesis are popped
                                               /     from top. Brackets are
                                               (     discarded. Stack empty

                     Operator / pushed to
                     stack                                                            V W Z * /
                                               /

                     Left parenthesis pushed
                     to stack                                                         V W Z * /
                                               (
                                               /

                     Operand Y sent to
                     output                                                           V W Z * / Y
                                               (
                                               /

                     Operator + pushed to
                     stack                     +                                      V W Z * / Y

                                               (
                                               /

                     Operand X sent to
                     output                                                           V W Z * / Y X
                                               +
                                               (
                                               /

                     Right parenthesis )
                     pushed to stack
                                               )     Operators between right
                                               +     and left parenthesis are         V W Z * / Y X +
                                               (     popped from top.
                                               /     Brackets are discarded.

                     End of expression
                                               /     Remaining operators              V W Z * / Y X + /
                                                     popped. Stack empty

                     Reverse of the resultant postfix expression: / + X Y / * Z W V
                     Prefix expression = / + X Y / * Z W V

                b.  Bracket Method

               Ans.  (X + Y)/(Z*W/V)
                    = ( ( X + Y ) / ( (Z * W) / V) )
                    = ( ( + X Y ) / ( ( * Z W ) / V) )
                    = ( (+ X Y ) / ( / * Z W V) )
                    = / + X Y / * Z W V



                508508  Touchpad Computer Science-XII
   505   506   507   508   509   510   511   512   513   514   515