Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
merge_sort solution in Speedy category for Count Inversions by ciel
def M(l,r):
if l+1>=r: return 0
if l+2==r:
if A[l]<=A[l+1]: return 0
A[l],A[l+1]=A[l+1],A[l]
return 1
m = (l+r)//2
i=l
j=m
k=l
cl=M(l,m)
cr=M(m,r)
c=0
while i
Sept. 3, 2014
Comments: