Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALGOIT(T,i)
- ST=STI=STA=LAST=NIL
- CT=T
- while(ct!=nil || st!=nil)do
- if(ct!=nil)then
- a=g(i)
- st=sti=sta=push()
- ci=2*ci
- ct=ct->sx
- else
- ct=i=a=top()
- if(last!=ct->dx && ct->dx!=nil)then
- z=val
- a=z+(ct->key)*i+a
- sta=pop(sta)
- sta=push(sta,a) //cambia valora di a
- ci=2*i+1
- ct=ct->dx
- else
- if(ct->dx=nil)then
- z=val
- a=z+(ct->key)*i+a
- z=a+g(2*i+1)
- else
- z=top(sta)+val
- last=ct
- ct=nil
- pop(sta,a,i)
- return 3*z
Add Comment
Please, Sign In to add comment