时间复杂度O(n^2)
1.laji版
def select_sort_imple(ls):
ls_new=[]
for i in range(len(ls)):
min_value=min(ls)
ls_new.append(min_value)
ls.remove(min_value)
return ls_new
2.升级版
def select_sort(ls):
for i in range(len(ls)):
min_loc=i
for j in range(i+1,len(ls)):
if ls[j]<ls[min_loc]:
min_loc=j
ls[i],ls[min_loc]=ls[min_loc],ls[i]