Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algo_Iterative(T,k1,k2,L)
- ST=STL=LAST=NIL
- CT=T
- while(ct!=NIL || st!=NIL)do
- if(ct!=NIL)then
- st=push(st,ct)
- ct=ct->f1
- else
- ct=top(st)
- if(last!=ct->f2 && last !=ct->f3 && ct->f2!=NIL)then //I CHIAMATA CON 2 E 3 DIVERSI DA NIL
- L'=val
- stl=push(STL,L)
- L=L'
- ct=ct->f2 //preparo la seconda che non è nil
- else if(last!=ct->f2 && last !=ct->f3 && ct->f2=NIL && ct->f3!=NIL)then //I CHIAMATA CON 2 NIL E 3 NON NIL
- L'=val
- ct=ct->f3 //preparo la terza che non è nil dopo che ho preso il valore dalla prima chiamata
- L=L'
- else if(last!=ct->f2 && last !=ct->f3 && ct->f2=NIL && ct->f3=NIL)then //I CHIAMATA CON 2 E 3 NIL
- L'=val
- Stl=push(stl,l)
- else
- if(last!=ct->f3 && ct->f3!=NIL)then //2 CHIAMATA CON 3 DIVERSO DA NIL
- L'=val
- stl=push(stl,l)
- ct=ct->f3 //preparo la terza chiamata che non è nil
- else if(last!=ct->f3 && ct->f3=NIL)then //2 CHIAMATA CON 3 NIL
- L'=val
- stl=push(stl,l)
- else //3 CHIAMATA
- L'=val
- if(k1<=ct->key<=k2)then
- L=Alloca_nodo()
- L->key=ct-key
- L->next=L'
- else
- L=L'
- + uscita algoritmo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement