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:冒泡排序
猜你喜欢
转载自blog.csdn.net/weixin_38246633/article/details/80686160
今日推荐
周排行