python算法实践5-直接选择排序

#直接选择排序 def SelectSort(mylist): size = len(mylist) i = 0 for i in range(0, size): k = i for j in range(i + 1, size): if mylist[j] < mylist[k]: k = j if k != i: tmp = mylist[i] mylist[i] = mylist[k] mylist[k] = tmp mylist0 = [11, 2, 3, 4, 112, 100] SelectSort(mylist0) print(mylist0)

你可能感兴趣的:(python算法实践5-直接选择排序)