首页 > 算法基础之冒泡排序

算法基础之冒泡排序

data=[10,4,33,21,54,3,9,11]

//for index,i in enumerate(data[0:-1):

for j in range(1,len(data)):

  for i in range(len(data)-j):

  

    if data[i]>data[i+1]:

      temp=data[i+1]

      data[i+1]=data[i]

      data[i]=temp

    

print(data)

    

转载于:https://www.cnblogs.com/my334420/p/6407843.html

更多相关: