冒泡排序(LOW)
# _*_coding:utf-8_*_
import random
def bubble_sort(li):
for i in range(len(li)-1):
exchange = False
for j in range(len(li)-i-1):
if li[j] > li[j+1]:
li[j], li[j+1] = li[j+1], li[j]
exchange = True
if not exchange:
return
li = list(range(100))
random.shuffle(li)
print(li)
bubble_sort(li)
print(li)