Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algo(T,k)
- ST=STX=STRET=LAST=NIL
- CT=T
- while(ct!=NIL || st!=NIL)do
- if(ct!=NIL)then
- ret=inf
- x=ct->k%2
- st=stx=push()
- ct=ct->sx
- else
- ct=top(st); x=top(stx);
- if(last!=ct->dx && ct->dx!=NIL)then
- y=val
- if(x=k%2)then
- ret=0
- else
- ret=y
- stret=push(stret,ret)
- ct=ct->dx
- else
- if(ct->dx=NIL)then
- y=val
- if(x=k%2)then
- ret=0
- else
- ret=y
- z=inf/nil
- ret=min(ret,z)+1
- + uscita algoritmo
- else
- z=val
- ret=min(top(stret),z)+1
- + uscita algoritmo
- return ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement