Advertisement
Davencode

Untitled

Sep 20th, 2021
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. CountOddIter(T)
  2. ST=STRET=STRSX=LAST=NIL
  3. CT=T
  4. while(ct!=NIL || st!=NIL)do
  5. if(ct!=NIL)then
  6. ret=0
  7. if(ct->key%2=1)then
  8. ret=ct->key
  9. st=push(st,ct)
  10. stret=push(stret,ret)
  11. ct=ct->sx
  12. else
  13. ct=top(st)
  14. if(last!=ct->dx && ct->dx!=NIL)then
  15. rsx=val
  16. strsx=push(strsx,rsx)
  17. ct=ct->dx //preparo 2
  18. else
  19. if(ct->dx=NIL)then
  20. rsx=val
  21. rdx=0
  22. ret=top(stret)+rsx+rdx
  23. + uscita
  24. else
  25. top(strsx)
  26. rdx=val
  27. ret=top(stret)+rsx+rdx
  28. + uscita
  29. return ret
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement