一、冒泡排序

'''冒泡排序'''
# coding:utf-8
list = [1, 13, 5, 35, 6, 9, 10]
s = range(len(list))[::-1]
print(s)
for i in s:
for j in range(i):
if list[j] > list[j +1 ]:
list[j], list[j + 1] = list[j + 1], list[j]
print(list)

posted on 2020-03-04 11:53  星——  阅读(276)  评论(0编辑  收藏  举报