Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algo_it(T,a,b)
- ct=T;
- last=nil;
- stack_t=nil;
- while(ct!=nil or stack_t!=nil)do
- if (ct!=nil)then
- if (ct->key < a)then
- push(stack_t,ct);
- ct=ct->sx;
- else if(ct->key > b)then
- push(stack_t,ct);
- ct=ct->dx;
- else
- push(stack_t,ct);
- ct=ct->sx;
- else
- ct=top(stack_t)
- if (last!=ct->dx)then
- ct->sx=ret;
- if(ct->key <a)then
- pop(stack_t);
- last=ct;
- ct=nil;
- else
- if(ct->dx!=nil)then
- ct=ct->dx;
- else
- ct=cancella_root(ct)
- pop(stack_t);
- last=ct;
- ct=nil;
- else
- ct->dx=ret
- if(ct->key > b)then
- pop(stack_t);
- last=ct;
- ct=nil;
- else
- ct=cancella_root(ct)
- pop(stack_t);
- last=ct;
- ct=nil;
- return ct;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement