选择排序:
array =[8,2,6,3,4,5,7,1,10,9]
L=len(array)
for i in range(1,L):
temp = array[i]
array.remove(array[i])
for j in range(i):
if array[j]>temp:
array.insert(j,temp)
break
else:
array.insert(i,temp)
print(array)
选择排序:
array =[8,2,6,3,4,5,7,1,10,9]
L=len(array)
for i in range(1,L):
temp = array[i]
array.remove(array[i])
for j in range(i):
if array[j]>temp:
array.insert(j,temp)
break
else:
array.insert(i,temp)
print(array)