def MyPartition(a,p,r):
x = a[r]
i = p-1
for j in range(p,r):
if a[j]<=x:
i=i+1
a[i],a[j] = a[j],a[i]
a[i+1],a[r] = a[r],a[i+1]
return i+1
def MyQuickInsertSort(a): #插入法快速排序#
i = MyPartition(a,0,len(a)-1)
temp = a[:i]
MyInsertSort(a[:i])
a[:i] = temp
temp = a[i+1:]
MyInsertSort(temp)
a[i+1:] = temp