def bubble_sort(lst):
for i in range(len(lst)):
found = False
for j in range(1,len(lst)-1):
if lst[j-1] > lst[j]:
lst[j-1],lst[j] = lst[j],lst[j-1]
found = True
if not found:
break
python数据结构5:冒泡排序
最新推荐文章于 2021-11-20 23:22:36 发布