Davencode

Untitled

Feb 10th, 2022 (edited)
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. ALGOIT(T,i)
  2. ST=STI=STA=LAST=NIL
  3. CT=T
  4. while(ct!=nil || st!=nil)do
  5. if(ct!=nil)then
  6. a=g(i)
  7. st=sti=sta=push()
  8. ci=2*ci
  9. ct=ct->sx
  10. else
  11. ct=i=a=top()
  12. if(last!=ct->dx && ct->dx!=nil)then
  13. z=val
  14. a=z+(ct->key)*i+a
  15. sta=pop(sta)
  16. sta=push(sta,a) //cambia valora di a
  17. ci=2*i+1
  18. ct=ct->dx
  19. else
  20. if(ct->dx=nil)then
  21. z=val
  22. a=z+(ct->key)*i+a
  23. z=a+g(2*i+1)
  24. else
  25. z=top(sta)+val
  26.  
  27. last=ct
  28. ct=nil
  29. pop(sta,a,i)
  30. return 3*z
  31.  
Add Comment
Please, Sign In to add comment