Advertisement
Davencode

Untitled

Oct 22nd, 2021
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. Algo_Iterative(T,k1,k2,L)
  2. ST=STL=LAST=NIL
  3. CT=T
  4. while(ct!=NIL || st!=NIL)do
  5. if(ct!=NIL)then
  6. st=push(st,ct)
  7. ct=ct->f1
  8. else
  9. ct=top(st)
  10. if(last!=ct->f2 && last !=ct->f3 && ct->f2!=NIL)then //I CHIAMATA CON 2 E 3 DIVERSI DA NIL
  11. L'=val
  12. stl=push(STL,L)
  13. L=L'
  14. ct=ct->f2 //preparo la seconda che non è nil
  15. else if(last!=ct->f2 && last !=ct->f3 && ct->f2=NIL && ct->f3!=NIL)then //I CHIAMATA CON 2 NIL E 3 NON NIL
  16. L'=val
  17. ct=ct->f3 //preparo la terza che non è nil dopo che ho preso il valore dalla prima chiamata
  18. L=L'
  19. else if(last!=ct->f2 && last !=ct->f3 && ct->f2=NIL && ct->f3=NIL)then //I CHIAMATA CON 2 E 3 NIL
  20. L'=val
  21. Stl=push(stl,l)
  22. else
  23. if(last!=ct->f3 && ct->f3!=NIL)then //2 CHIAMATA CON 3 DIVERSO DA NIL
  24. L'=val
  25. stl=push(stl,l)
  26. ct=ct->f3 //preparo la terza chiamata che non è nil
  27. else if(last!=ct->f3 && ct->f3=NIL)then //2 CHIAMATA CON 3 NIL
  28. L'=val
  29. stl=push(stl,l)
  30. else //3 CHIAMATA
  31. L'=val
  32. if(k1<=ct->key<=k2)then
  33. L=Alloca_nodo()
  34. L->key=ct-key
  35. L->next=L'
  36. else
  37. L=L'
  38. + uscita algoritmo
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement