def merge(a,s,e,mid):
n1 = mid-s+1
n2 = e-mid
L = [0]*(n1)
R = [0]*(n2)
for i in range(0,n1):
L[i] = a[s+i]
for j in range(0,n2):
R[j] = a[mid+1+j]
i = 0
j= 0
k = s
while(i< n1 and j< n2):
if L[i]<=R[j]:
a[k] = L[i]
k +=1
i +=1
else:
a[k] = R[j]
print(temp)
k+=1
j+=1
while i<=n1:
a[k] = L[i]
k+=1
i+=1
while j<=n2:
a[k]=R[j]
k+=1
i+=1
def mergeSort(a,s,e):
if s==e:
return
mid = s+(e-1)//2
mergeSort(a,s,mid)
mergeSort(a,mid+1,e)
merge(a,s,e,mid)
l = [8,9,16,1,2,3,4,5]
mergeSort(l,0,len(l)-1)
print(l)