Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 4

MoigoSoil(a,log,ond)

ßogin
If(log < ond) lhon
Sol nid=(log+ond)/2
CaII MLRCLSORT (a,log,nid),
CaII MLRCLSORT(a,nid+1,ond),
CaII
MLRCLSORTLDSUßARRAYS(a,log,nid,nid+
1,ond),
Lnd II
LND
BcgIn
5ct na=!b nb=rb and nc=!b
WhI!c((na<=!r) and (nb<=rr)) dn
If( a[na] < b[nb]) thcn
5ct c[nc]=a[na]
5ct na=na+1
E!sc
5ct c[nc]=a[nb]
5ct nb=nb+1
End IF
5ct nc=nc+1,
EndWHILE
If(na>!r) thcn
whI!c(nb<=rr) thcn
5ct c[nc]=b[nb]
5ct nb=nb+1
5ct nc=nc+1
End whI!c
E!sc
WhI!c(na<=!r) thcn
5ct c[nc]=b[na]
5ct na=na+1
5ct nc=nc+1
EndwhI!c
Fnr(k=!b tn rr )
5ct a[k]=c[k]
Endfnr
End
O(nIog2n)

You might also like