冒泡
def boll(lis):i = 0while i<len(lis)-1:j = 0while j<len(lis)-1-i:if lis[j] > lis[j+1]:lis[j],lis[j + 1] = lis[j+1],lis[j]j+=1i+=1
选择排序
def selct1(lit):i = 0while i<len(lit)-1:j =i+1min1 = iwhile j < len(lit):if lit[j] < lit[min1]:min1 = jj += 1lit[i],lit[min1] = lit[min1],lit[i]i+=1
插入
def insert(lit):i = 1for i in range(1,len(lit)):j = i-1#手牌下标tmp = lit[i] #抓牌下标while j>=0 and lit[j]>tmp:lit[j+1] = lit[j]j-=1lit[j+1] = tmp