算法1—冒泡排序

import random
import time
times=time.time()
list=[]
for i in range(0,100):
j=random.randint(1,100)
list.append(j)
# print(list)
for i in range(0,len(list)-1):
for j in range(0,len(list)-i-1):
if list[j]>list[j+1]:
list[j],list[j+1]=list[j+1],list[j]
timee=time.time()
print(timee-times)
print(list)

 


posted @ 2019-07-30 00:38  Aluosen  阅读(209)  评论(0编辑  收藏  举报