def bubble_sort(data):
'''
冒泡排序
:paramdata:
:return:
'''
length =len(data)
for i in range(length -1):
for j in range(length - i -1):
if data[j] > data[j +1]:
data[j], data[j +1] = data[j +1], data[j]
return data
def bubble_sort(data):
'''
冒泡排序
:paramdata:
:return:
'''
length =len(data)
for i in range(length -1):
for j in range(length - i -1):
if data[j] > data[j +1]:
data[j], data[j +1] = data[j +1], data[j]
return data
本文标题:01_冒泡排序
本文链接:https://www.haomeiwen.com/subject/oxdfwqtx.html
网友评论