Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Algo(T,L)
- ct=null st=null
- cx=null sx=null
- cp=null sp=null
- cld=null sld=null
- cl=null
- next=null
- last=null
- ret=null
- while(ct!=null || st!=null) then
- if(ct!=null) then
- cp=ct->k%2
- sp=push(cp,sp)
- st=push(ct,st)
- next=ct->dx
- else
- ct=top(st)
- if(ct->sx!=null && ct->sx!=last) then
- cld=ret
- if(cp=0)then
- cx=NEW-NODE(ct->k)
- sx=push(cx,sx)
- sld=push(cld,sld)
- cl=cx
- else
- cl=cld
- next=ct->sx
- else
- sp=top(cp)
- if(ct->sx!=null) then
- cl=ret
- if(cp=0) then
- cld=top(sld)
- cx->next=cld
- else
- cld=ret
- cl=null
- if(cp=0) then
- cx=NEW-NODE(ct->k)
- cld=top(sld)
- cx->next=cld
- ret=cl
- next=null
- pop(di tutto)
- last=ct
- ct=next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement