Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALGO_IT(T,k1,k2,L)
- Stack_T=Stack_L'=Last=NIL
- CT=T
- while(ct!=NIL || st!=NIL)do
- if(ct!=NIL)then
- Stack_T=push(Stack_T,ct)
- Stack_L'=push(Stack_L',L') x
- ct=ct->f1 //Qui preparo chiamata riga 2
- else
- ct=top(Stack_T); l'=top(Stack_L') //Risalendo
- //TORNO SICURAMENTE DALLA PRIMA CHIAMATA
- I chiamata con seconda chiamata e terza diverse da NULL
- if(last!=ct->f2 && last!=ct->f3 && ct->f2!= NIL && ct->f3 != NIL)then
- L'=val //Prendo ritorno chiamata riga 2
- ct=ct->f2 //preparo chiamata di riga 3
- L=L'
- else
- //CONTROLLO LA SECONDA CHIAMATA
- I chiamata con seconda chiamata =NIL e la terza != NIL
- if(last!=ct->f2 && last!=ct->f3 && ct->f2=NIL && ct->f3!=NIL)then
- L'=val //prendo ritorno chiamata riga 3
- ct=ct->f3 //preparo chiamata riga 4
- //CONTROLLO LA TERZA per verificare se รจ tutto vuoto dopo e proseguo
- //I chiamata con seconda e terza chiamata = NIL
- else if(last!=ct->f2 && last!=ct->f3 && ct->f2=NIL && ct->f3=NIL)then
- L'=NIL
- if(k1 <= ct->key <= k2)then
- L = ALLOCA_NODO()
- L->key = CT->key
- L->next = L'
- else
- L=L'
- +uscita
- else
- //II CHIAMATA CON LA TERZA !=NIL
- if(last!=ct->f3 && ct->f3 !=NIL)then
- L'=val
- ct=ct->f3
- L=L'
- //chiamate NULL
- else
- if(last!=ct->f3 && ct->f3=NIL)then
- L'=NIL
- if(k1 <= ct->key <= k2)then
- L = ALLOCA_NODO()
- L->key = CT->key
- L->next = L'
- else
- L=L'
- else
- L'=val
- if(k1 <= Ct->key <= k2){
- L = ALLOCA_NODO()
- L->key = CT->key
- L->next = L'
- }else{
- L = L'
- }
- /*FORZA RISALITA*/
- pop(STt)
- ret = L
- LT = CT
- CT = NULL
Add Comment
Please, Sign In to add comment