Pytho : 算法-选择排序
作者:互联网
找到最小元素
def FindSmall(list):
min = list[0]
for i in range(len(list)):
if list[i] < min:
min = list[i]
return min
选择排序
def Select_Sort(list):
newArr = []
for i in range(len(list)):
minValue = FindSmall(list)
newArr.append((minValue))
list.remove(minValue)
return newArr
testArr = [1361,22,333,21,123]
print(Select_Sort(testArr))
标签:Sort,Pytho,min,newArr,list,range,minValue,算法,排序 来源: https://blog.csdn.net/weixin_44523387/article/details/90607798