Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALGOIT(T)
- ST=STX=LAST=NIL
- ct=t
- while(ct!=NIL || st!=NIL)do
- if(ct!=NIL)then
- ret=1
- x=ct->key%2
- st=push(st,ct)
- stx=push(stx,x)
- ct=ct->dx
- else
- ct=top(st); x=top(stx)
- if(last!=ct->sx && ct->sx!=NIL)then
- a=val
- x=a+x
- pop(stx)
- stx=push(stx,x)
- ct=ct->sx
- else
- if(ct->sx=NIL)then
- x=a+x
- y=1
- ret=x*y*ct->key
- last=ct
- ct=NIL
- pop(st,x)
- else
- y=val
- ret=top(stx)*y*ct->key
- last=ct
- ct=NIL
- pop(st,x) //abbreviato sto poppando sia st che x
- return ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement