Davencode

Untitled

Sep 2nd, 2021 (edited)
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. ALGO_IT(T,k1,k2,L)
  2. Stack_T=Stack_L'=Last=NIL
  3. CT=T
  4. while(ct!=NIL || st!=NIL)do
  5. if(ct!=NIL)then
  6. Stack_T=push(Stack_T,ct)
  7. Stack_L'=push(Stack_L',L') x
  8. ct=ct->f1 //Qui preparo chiamata riga 2
  9. else
  10. ct=top(Stack_T); l'=top(Stack_L') //Risalendo
  11. //TORNO SICURAMENTE DALLA PRIMA CHIAMATA
  12. I chiamata con seconda chiamata e terza diverse da NULL
  13. if(last!=ct->f2 && last!=ct->f3 && ct->f2!= NIL && ct->f3 != NIL)then
  14. L'=val //Prendo ritorno chiamata riga 2
  15. ct=ct->f2 //preparo chiamata di riga 3
  16. L=L'
  17. else
  18. //CONTROLLO LA SECONDA CHIAMATA
  19. I chiamata con seconda chiamata =NIL e la terza != NIL
  20. if(last!=ct->f2 && last!=ct->f3 && ct->f2=NIL && ct->f3!=NIL)then
  21. L'=val //prendo ritorno chiamata riga 3
  22. ct=ct->f3 //preparo chiamata riga 4
  23. //CONTROLLO LA TERZA per verificare se รจ tutto vuoto dopo e proseguo
  24. //I chiamata con seconda e terza chiamata = NIL
  25. else if(last!=ct->f2 && last!=ct->f3 && ct->f2=NIL && ct->f3=NIL)then
  26. L'=NIL
  27. if(k1 <= ct->key <= k2)then
  28. L = ALLOCA_NODO()
  29. L->key = CT->key
  30. L->next = L'
  31. else
  32. L=L'
  33. +uscita
  34. else
  35. //II CHIAMATA CON LA TERZA !=NIL
  36. if(last!=ct->f3 && ct->f3 !=NIL)then
  37. L'=val
  38. ct=ct->f3
  39. L=L'
  40. //chiamate NULL
  41. else
  42. if(last!=ct->f3 && ct->f3=NIL)then
  43. L'=NIL
  44. if(k1 <= ct->key <= k2)then
  45. L = ALLOCA_NODO()
  46. L->key = CT->key
  47. L->next = L'
  48. else
  49. L=L'
  50. else
  51. L'=val
  52. if(k1 <= Ct->key <= k2){
  53. L = ALLOCA_NODO()
  54. L->key = CT->key
  55. L->next = L'
  56. }else{
  57. L = L'
  58. }
  59. /*FORZA RISALITA*/
  60. pop(STt)
  61. ret = L
  62. LT = CT
  63. CT = NULL
  64.  
  65.  
  66.  
Add Comment
Please, Sign In to add comment