基于北航童老师算法课程的伪代码改的
n=eval(input())
c=[]
c1=[]
for i in range(n):
c.append(eval(input()))
c1.append(0)
def mergesort(c,left,right):
if left<right:
mid=int((left+right)//2)
mergesort(c,left,mid)
mergesort(c,mid+1,right)
merge(c,left,mid,right)
return merge(c,left,mid,right)
def merge(c,left,mid,right):
i=left
j=mid+1
k=left
while i <= mid and j <= right:
if c[i]<c[j]:
c1[k]=c[i]
i=i+1
elif c[j]<c[i]:
c1[k]=c[j]
j=j+1
k=1+k
if i>mid:
for d in range(j,right+1):
c1[k]=c[d]
k+=1
else:
for d in range(i,mid+1):
c1[k]=c[d]
k+=1
i=left
while i<=right:
c[i]=c1[i]
i+=1
return c
print(mergesort(c,0,len(c)-1))