Page 506 - Computer science 868 Class 12
P. 506

Operand A sent to                                                        A

                     output                  (


                     Operator + pushed to                                                     A
                     stack                   +
                                             (


                     Operand B sent to                                                        A B
                     output                  +
                                             (


                     Operator * has a higher                                                  A B
                     precedence than the     *
                     current operator + at   +

                     top. So * operator pushed   (
                     to stack

                     Operand C sent to       *                                                A B C
                     output                  +

                                             (

                     Operator – has a lower                                                   A B C *
                     precedence than the              -

                     current operator * at   +
                     top. So * is popped     (
                     and added to output

                     Operator - has equal                                                     A B C * +
                     precedence than the              -
                     current operator + at

                     top. So + is popped     (
                     and added to output

                     Operator - pushed to                                                     A B C * +
                     stack                   -
                                             (


                     Operand D sent to       -                                                A B C * + D
                     output                  (











                504504  Touchpad Computer Science-XII
   501   502   503   504   505   506   507   508   509   510   511