Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AlgoIT(T,a,b)
- ct=-1 st=null
- next=last=null
- ret=null
- while(ct!=null && st!=null) then
- if(ct!=null) then
- if(ct->key<b) then
- st=push(ct,st)
- next=ct->dx
- else
- st=push(st)
- next=ct->sx
- else
- ct=top(st)
- if(ct->dx!=null && ct->dx!=last) then
- ct->sx=ret
- if(ct->key<a) then
- ret=ct
- else
- next=ct->dx
- else
- if(ct->dx!=null) then
- if(ct->key>b) then
- ct->dx=ret
- ret=ct
- else
- ct->dx=ret
- ct=F(ct)
- ret=ct
- else
- if(ct->key>b) then
- ct->dx=null
- ret=ct
- next=null
- else
- ct->dx=null
- ct=F(ct)
- ret=ct
- st=pop(st)
- last=ct
- ct=next
- return ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement