Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ALGOIT(T,k)
- ST=STA=LAST=NIL
- CT=T
- while(ct!=NIL || st!=NIL)do
- if(ct!=NIL)then
- a=NIL
- b=NIL
- if(ct->key < k)then
- a=ct
- sta=push(sta,a)
- st=push(st,ct)
- ct=ct->dx
- else if(ct->key > k)then
- st=push(st,ct)
- ct=ct->sx
- b=ct
- else
- st=push(st,ct)
- ct=ct->dx
- else
- ct=top(st)
- if(ct->key < k)then
- top(sta)
- b=val
- ret=best(a,b,k)
- + uscita
- else if(ct->key > k)then
- a=val
- b=ct
- ret=best(a,b,k)
- + uscita
- else
- if(last!=ct->sx && ct->sx!=NIL)then
- a=val
- sta=push(sta,a)
- ct=ct->sx
- else
- if(ct->sx=NIL)then
- a=val
- b=NIL
- ret=best(a,b,k)
- + uscita
- else
- b=val
- ret=best(top(sta),b,k)
- + uscita
Add Comment
Please, Sign In to add comment