python 冒泡排序
2021-06-20 05:06
标签:pytho sort print range 冒泡排序 highlight count python list python 冒泡排序 标签:pytho sort print range 冒泡排序 highlight count python list 原文地址:https://www.cnblogs.com/sea-stream/p/9689044.htmldef bubble_sort(blist):
count = len(blist)
for i in range(0, count):
for j in range(i + 1, count):
if blist[i] > blist[j]:
blist[i], blist[j] = blist[j], blist[i]
return blist
blist = bubble_sort([4,5,6,7,3,2,6,9,8])
print(blist)
下一篇:python 散列表查找