Unit2 (Stack)
Unit2 (Stack)
'Ob 1) (l :
1 I
                                                           I                                           '        I               I                    I   J           ·,        I
                                                           l~e..p~~~ i i
                                                                                                            I
                                                                                                                                                                                       s~
                                         I                                     '           I             I                                            I
 CD
                                         1
                       1
                                 \   \
         ~ ' 4 v - ~ ~ ~ n\
1'"0,•   L                                                        ()               I           ' )   \            I           I       '   I       \
    t     t'nk-::-    · t
                     11\:,               e1..-,
                                             1''((> o l " .-..L~rl- o -
                                                  ---<> ~U1Ll..,v\l.-U ,YI)                                               '
I J I I ) ) J) ) '
(D A.rt--~ l ~ u ~ ' l : I I
                                                                                                                                          Le__ ::.
                                                                                                                                                                                T_
                                                                                                                                                                                  l
                                                                                                                                                                                ---9   l
                                         I ()                          I
                                                                                                                                                                            I
1 ,-
                                                   1                                   _..!.
                                                                                                                                                                   )
  CT
                             I                                                                                                                    I
              , 11     !2... 0               Lt                       (.                                                                                                               ,_
                                                                                                                                                          I
                                         lpoP?.                   1                    1                                                                                '
                                                                                                                                                                                            1
                                                                                                                                                                                            f)   I
                                                                                                                                                              Y'~c_cJ
                                                                                                                                                                   .. t;r"- -l
                                                                                                                                                                       ~kt.w -U                      ,
CD.         ' ru~H
(9          Pop                                                                                             .
            s        (\, .
                         I
I
    1
        \                         J , \,   , \   ,'   ;        1,       l\   )' :       '   I I \ l     j
     ,I
                     , , O'.)              'C-:he_clv-, f\J}·                 9Ve_irrs f                        lo~.
                                                                      ¥                   4--6 \) "f'ctL.J_ \fo \) ++-
                                                                               1
\<2? ) I ' \ 1~
                                                                             -
                         I
                                                                                            -
                                                                                                                       r
                              I
                                                                                    -           I
                                            '
                                                                                                                       h
                                                                                    C
                                                                                                                       c..'
                                A      '
                                           -
                                            I
                                                          11
                                                          f\
                                                                -
                                                                    it:;-
                                                                              I~
                                                                                   1\               '                  fr \
    A½or,~               I
                                             01 :
                                         I             /\
                                         0
                                 I       O     \ I/ I
                                              ,I
II J I I I 1
•    '' I                                                                              ll
                                                                                       I
                     j       J
                                                                                                                           I    ;
                              -
                                                p ~ A              Q    ~ht~
                             w i . u  , , -  o
~     C..On&,'d..u.. -Uu.. ~
                                              ) ® ~Pt)
                           @   P u .1b  ( r n
 (D . Pu.s.h ( u : ,J                               © PoPcJ
                        s-) ~ P\).s.h(3 0_ )
~               Pu.s.h(t
 (:[)         Po P l )                                    IJJ '1la1:   ~ o"-l,j
                        4              t~ O! e.. 0 P ~
    Ct f: k'.. ~ p'-Lfb
'b-e_ ct! t c p o         •
                  .
            I   ..
                      -
                                              5o
                      l   '-~
        J
                      j
-tor
2.
 !o     AL L1 o p :: : 2 - 0
         t""
       Aprh~ n o ~                                 5 tctc..k.
f     A   S. tEl ~      ~ l I J:'. 0            iJ- -U cc.8. iJ.-tv tf.o 'rt,        0 'f
                                                              I
 Q)       A~m ~ ..e_i ?~loh
             Q.      , ~' ~                   no kl£u;,        ,vO
             b,      P,~'x                    ,no~                                                                       t.
             c_,     1Dv~~,~ Y\--0~
             c; u  ~ PC\~ ~ 0 cl- ! ~ rn
                               .Q.                                                                    S>ttl.e_,k    ~~
           L,Q)1) N I f-lbl,() ' Vf' p ~ ,
                                                           AI B'     ~   } ' I P; ·°ti
                                                                 OP era.n cl,
                                                           +     I   -61,--.f
                                                                op~,..s,
~ u tVvOuJY) as (~t'xD
l. Unary ( - ,-+                   1
                                        !'Jot)
~ r -e f' ~ 0 n e_ h ,H 4} ( ~ ~t j f, .-
6 · ¾t                &t'v         ( ~ , /)                  5
                  >
                                                                                    L-   +o r2-
                                                                                    L    t-o f2-
                                                                             "41N
                                        BoDMA-S
                           {- D ,\ ,. i~ J /V-1.J) A-d.J,
                                                          ~ \.) 6.
             & - - r ~ I <a                 I
                              / ~    .
                                  s fr ~ ') ;                 -42a I
        o H-1' X,     Pk.ft:x
        ro~                  '
                                                                  t-           b L,
            Cl        +'         b e~                        Q         cl{-
                  o    be*+                                  +   Q     <X-    bL
                  Op~p~~-
                              0f                 y -J.
                                        C,)1? , ?J[,]
        1.       Ul'rni-~       (-,+ 1 ~ot)
                                                                             _ ~ntro I~-
; ~' -e 1-               one_1, -1-J        J•"'(11 ~}J               t) .
                                                                                  L-+o
         2, .            )    ct' \)             C 7)' ,     I)   5
                                                                                  L- +-a
    · 4. o_ctcl J            ~o \o           C + )-)              4
        ~ .
                -<1 >     <(_ :::       > = --= - l --=-                      L hf?-
        c.J ·        )              J        )       -   I   0    3
        b,          A-~.o                                                    L-   +o t2-
         7.      v ~, Xv            1'2--                         J                t-o f?-
    ;
j                                                BoDMAS
r
l
                      o be*+
                                                                                  ('_L:, •   I -
                           f>
                                    .
                                         Q )(   p--c
                                    I}') ~ ~·,x. \ ~05..~'x
                                                           e_"
                                                                        Pzr~'x
                                                                          ,'~~
                                                                              e~•        ½DL? >-,o Vlc.J                        I
                                                                   lU,:e__    fY·LJ...e._aU,;\          u. 95
                                                         Cv\A-0 u' ctJ"- uJ~
     A          - (_   ID       T   f
      AE>*-cD)tE
      1 ) L-J -
                                                                        ...       A-~    IC. D .            -t   t
                                                                              L                         J
                                                                                         \\
                                                                                  -t--~            Q,   I c_n e f
                                                                                   -\- -            A&l c:Df
  I
                                                                                                                                                      I
                                                                                                                                                          I
                                                                                                                                                          r
'1.t- p
                               l f'          op                                     Lou                                                                       I
                                                                                                                                                              I
                     C()               o'<-f'r) OH                    ¼ t' h-o o J__p_,-., e-J '<Lt- t                                                        t
                                                                                                                                                              i
                             IAJ Y\-€..Y-e..                                      -\-a~    MO 1-t
                                                                                                                                                      '
                                                       A                                             ele_r()
                              Q. ,0. tke._                     he )1-f.,     t-r,         ~         ~-J
                    b)                                                      A@ B                        @
                    C_J                 pku. fu                    Y-t..!<.LU-          4        &J.p   (0          b~              e.::
                    ~o../rlf>o-p
' r-p   ct V-o.L.u e.J\. \U:tl
        t,,   : i                                                     +,,   ,t1,t..n_     -hi"    e.1...,,,,~ . 6-)-J s ~-
·~--,-: ~~(t-
                                                                                                                                                  _J
                                                       ---=-==
                                                             ~
                     -                                   ___   ,
    "tl._o_,   {-o.uo u.., i::I                     Fl     b,r\ \-1,.,     <Q   1-JtJ,, '-'-1. -e.,j             IZl.        s. 1-<u.k
           ho\.d                                                                       P.
                     "
                     \f'                            p-e "f'CI..Y\ J                                               p~ tt
                                                                                                                                   I
                                 Qri        0                            tl      .e..n c.o u 11   re       ?s
                                       en
                                                                                                                                                     J;>
                I
1F Qn 0 p-e 1r ct.hnr ~ L b ~ 1 ·~ 11
Cl.f- l bf G) {J) t) P
                        '°
                                                                                                                      &~
                                                                               op~
                                                                                                                      w
              S,. r<)        i)   l      Uk") 'I) .e   d
        1)                        5                                             Pu S. ½          S"
2-) f u 'h G,
        ~)                                                                             Y)    2-                   t±=jA  5"
                                                                                                                                            ~® f\   .
    '
        y)
                                                                       PoP(2--~b>
                                                                    Pus.h ( G+2-)                                 w~                   e.
        s)                   -~
                                                              ?C)~ \ i
                                                                   u ',,.\:,     '.3
                                                                                        ~)
                                                                                       'Y,.- \ )                  w
        6')                   \ 2-                                 1)uc;.'h          \2-
                                                                                                                        't)
                                                                                                                               \€---A
        1)                                                    ~\J ~Y)                                                 \ 2..-
                                                                                                                      l-\.1>
                                                                                                                                        B
                                                                            l ~A Q.-A
                                                                                                                                   I
                                                           're f                 Lt
        ~)
                                                                                            D)
                        a:>                                                                                   .
                                                                  ~u (,.n      l 40- ?i)                  •
                                                                                                                  ?r't-
             ~)              )                                     e»J '
                                                                                        317
                                                           ....
                                      1\-Mwe r /                                 "
A
                     ½rn \..,oil   S.c...Gu)i1e   J      op~
    G                                                     P~h s:-                      5
           'J                 5
    (                                                  P~b             f>
          ~)                  8
           ~)                                           P~ h ) b
                        1b
                                                       Pof l I b~ '6)
           Y")            I                            plr-S. h ( I ' /     9)
.
f
          - '\
         s,,)           2                             rl.A.£n      2
                                                                                  s•,          l   L
                                                                                                   s-A
                                                                                 s-,
         (o ')                                        f~           2..                     21 '.L,
                                                                                                   -   2...,
        1 ')
                                                  ~b\) (_2      c\ 2..)          s' ~} 4
                                             Pwn l2             x. 2)
                                                             Ir
        8 )                                   Pop (        t{     4 2..)
                                             Pv1Y'\ (      4•2-)
+ Pop ( 2 ')
                                                                                             e.~r~~
                                                                                                                               ~ ~'81a.~
                                                                              {"'fri'x
         U) 'f\ V e,.<l:.,
                                                {-cllow1'<U}
                                         Po.lrb-Lv ;..
                                                                                                        .. . .    ....
                                                                                                                         .
                                                                                                                         .    ..... -   0        l
                     p!        g)_    3-:'k 5              ' I +-
                             S\.rm 'bo 1\                          .s..
                                                                    tn
                                                 t..A.Vl
Ci l) \>u1.'n 2
                     2)
                                                                    ffih                     {)u.S. 'n 3
                                                                   w
    G                                                                                                             Po P ~4 2..
                     oJ                                                                         Q.@A                                    ()~½
                                                                                                 2                       = f,
    (
'                    +j
                    s-)
                                     s
                                     i..
                                                                   w                             f u.,2:.~
                                                                                                     f ~n \
                                                                                                                                                      I
                                                                                                                                                      \
                                                                                                                                                          I
                    ')               I
                                                                   w                             ~oP
                                                                                                 {>~~ (
                                                                                                                    \ lt-
                                                                                                                             s.) \ )
                                                                   bd
                                                                                                                         s.             (,.
                    1)                                                                               \>o~
                                                                                                     Q~'t) ( S"°"+                          b)
                                         b y               +   -3 --;l; 16                   l.J / -                                    o
                                                                                                                                         i
    Q
                1   S-,      y , '2__           , /1 )     + fr-
                                                               J          I   2_ / 2_ : j\j             5 3 ,/J                               /f ,-
,.I                                 '     \   I IVI &,...   _   I
                                                                                                                                          a   111
         &        ConvML                                            ~LO,'~                                16\~'~ e.~
                   ¾ p'lrO L
                        "--V'"
                                   1 .,                 o
                                                    ~lspr ~                                          a.."'°J     ~'ve_           v •~
        CD        1'V1t:-,'x +-o                                               : -
                               (~ -'j.-            ?,       "2-) /                     c    '6 -r     t, .p) /, o)
        S~ti             pl\ ~e,,,()thV>J'z..e
                                       .                                                €..,'fl~ o ~
                                                                                                                    e_ _ ~
                                                                                                                    'f.nr"'l
                                    11r , 4 cni                         as.       r e "'6     'T"\r\e..    P-.~ULd t-"1 ca.
      Gk-f> 2-            -\tu._   Pct nur,                                   ' 2--e        e 'I' P· 1A1 I ll be.              \tL w:9
                                                                                       VO..~ ·      T,
      Skf t>       ;,       bk-p <D <l<Y                                 101\\ 6~ ~ & \::-ill t1A...L .\'ti~
                             e_~ \' · <l                                                to -e 'X ?· ~ u ) ~ 2--o ?-f-~
                            0->\d. 06) €..                              &t e_ .....J:ny •       -< op'"f'ik o p/ -<. o I'~ ;:
        1-,   n            L                                        .                                                   "1 ;+-$' ,_
      S a~4-                                            to:~                                 ~W~t--tl\.L-
                                                                                                                  tf-,-,,?J
                           GC(_tJ':.
          ( S Y-    &,    /4   2))                  3t   (
         (~ +Tj)               I(      ~-t (1f"J)/to)                       t\32        <)A2   = TJ
           i T&      I [ ?,f Llf?>)/Jo)                                 .-..s1;         s:n, ""            ) !)_
           ~\                                                      +:P,:J               1t      :=-    Tg
C                   fa ) (         3   -t   rr~, j /o))                 / T:3 )-v       T 3 (( o   = Ty
(
                    T.i,__.) ( 3 t-T            0                  +3 f~            ?:i-t f 4          Ts
                     T'1./ TS'                                 _ 1:>    2--   o f ~ l pe\ci-W      O
    /         ?-,13.                   t .3/ f 7 3                     /o
                                             P~ ~ I )
                    CLPpl~           ~       D     l '1"Y)o0 .
                                                                                          Ia      j
         G)                                  -e   1- j)~
                                                                                          S-*/
              ~\N),U e._         -t-w,
                        ID           3       lt- / ~,+ 2-- 2>"
                           1'
                   pcJ:-        11   )   '        0 \ '.)1-\k'          j)o,~   M   trh   -Q   )<,f·
                                                                                     ~J-a_.a..,l[_,
        @             S~rn'bo l~
                                                               or~~
                                                                                  w
                                -SLA-r)
                                                               ft,1J:. n Io
        1)            Jo
    2-)                                                    PU$ h 3
                                                           r
                         7
                                                               CAJ.,.   h 7-
                                                                                lid              r .3       8
I
•   9)
I                                                                                                      1~
I       ~)             t                              PD f { 74 3)                    D
                                                     ru~h {_ 71-3)                   l)
I       ~)           I                              f o P ( lo) Io)
                                                     Pu~~ ( ,01)o)              td
        6)                                         r~'n (3')                        §El
        ,)          +                             Pot (3cj)I)
                                                 G.Jsh{.3--1-J)                 ill
    g)                                       f     UJ      rJ ( 2-)             ffi
    1)
,..,-
              .3
              ---- --                    ---
                                             rvJh{ 3)
                                                      -
                                                                                ffi
        3 lf1Y1 ho l         OPua.~
                                       ,
                                                        s~
                                   B        A
                          pijp ( 2- 4, _3)               ff
  lo) I\
                         Pvsh ( 3 'L)                        4
                                                         5
11)                      Pu_s,½ ( 5)
                       foP     L ~<$ 1)                  4r
/:t)                   Pu·5,Y) (i;r1;_q)                 4
,~) ) (Jf-e..~p,
4f')y