Commit 5b3ebb3c by BellCodeEditor

save project

parent 92449b0c
Showing with 33 additions and 5 deletions
import time
a=[]
s1=time.time()
for i in range(1000):
a.insert(0,0)
#a.append(0)
s2=time.time()
print(s2-s1)
a=[]
s1=time.time()
for i in range(1000):
#a.insert(0,0)
a.append(0)
s2=time.time()
print(s2-s1)
\ No newline at end of file
list1 = [] a=[20,17,9,13,5,6]
for a in range(0, 1000): n=len(a)
for b in range(0, 1000): for i in range(n-1):
list1.insert(0, 0) flag=1
\ No newline at end of file for j in range(n-1-i):
if a[j] < a[j+1]:
c=a[j]
a[j]=a[j+1]
a[j+1]=c
flag=0
if flag==1:
break
else:
print("第",i+1,"轮的排序结果是:",a)
print("最终的排序结果是:",a)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment