一、冒泡排序
‘‘‘冒泡排序‘‘‘
# 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)
原文地址:https://www.cnblogs.com/queenz-852/p/12408607.html
时间: 2024-10-15 04:44:03