冒泡:相邻两个进行比较,将最大的置于最后
#coding=utf-8
def bubble_sort(alist):
"""冒泡排序"""
n=len(alist)
for i in range(n-1):
count=0
for j in range(n-i-1):
if alist[j]>alist[j+1]:
alist[j],alist[j+1]=alist[j+1],alist[j]
count+=1
if count==0:
return