冒泡排序的python实现
def sort(arr):
count = len(arr) - 1
for i in range(count):
for j in range(count-i):
if arr[j] < arr[j+1]:
arr[j], arr[j+1] = arr[j+1], arr[j]
return arr
l = [5, 2, 7, 8, 6, 1, 4, 9, 10, 1, 2, 3, 4]
print(sort(l))
分享文章:冒泡排序的python实现
标题URL:http://scyanting.com/article/pssegs.html