Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 28-06-17 (traduzione RIC-IT)
- ALGO(T,a,b)
- ST=LAST=NIL
- CT=T
- while(ct!=NIL || st!=NIL)do
- if(ct!=NIL)then
- if(ct->key<a || st->key>b)then
- st=push(st,ct)
- if(ct->key<a)then
- ct=ct->sx
- else if(ct->key>b)then
- ct=ct->dx
- else
- ct=ct->sx
- else
- ct=top(st)
- if(ct->key<a)then
- ct->sx=val
- last=ct
- ct=NIL
- pop(st)
- else if(ct->key>b)then
- ct->dx=val
- last=ct
- ct=NIL
- pop(st)
- else
- if(last!=ct->dx && ct->dx!=NIL)then
- ct->sx=val
- ct=ct->dx
- else
- if(ct->dx = NIL)then
- ct->sx=val
- ct->dx=NIL
- ct=cancellaradice(ct)
- else
- ct->dx=val
- ct=cancellaradice(ct)
- last=ct
- ct=NIL
- pop(st)
- return ct
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement