Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 23/02/2018
- ALGO_IT(A,i,j)
- STJ=STQ=STRET=STY=LAST=NIL
- ci=i; cj=j
- while(ci<=cj || stj != NIL)do
- if(ci<=cj)then
- x=A[ci]
- y=A[cj]
- ret=0
- q=ci+cj/2
- if(ci<q)then
- stq=stj=stret=push()
- cj=q
- else if(q+1<cj)then
- stq=stret=push()
- else
- +uscita dall'algo perché non entrerò in nessuno dei precedenti if (dipende poi dal ret=ret+x o y se sta fuori)
- else
- q=top(stq); cj=top(stj); ret=top(stret);
- if(last!=cj)then
- x=val
- pop(stret)
- ret=ret+x
- stret=push(stret,ret)
- if(q+1<cj)then
- ci=q+1
- else
- +uscita dall'algoritmo
- else
- if(q+1<cj)then
- y=val
- sty=push(sty,y)
- top(stret)
- pop(stret)
- ret=ret+y
- stret=push(stret,ret)
- else
- y=A[cj]
- top(stret)
- pop(stret)
- ret=ret+y
- stret=push(stret,ret)
- +uscita dall'algoritmo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement