冒泡排序

var = [5, 10, 8 , 3, 12, 1, 15]

def arange(var):
    length = len(var)
    for i in range(length-1):
        for j in range(length-1-i):
            if var[j] < var[j+1]:
                var[j], var[j+1] = var[j+1], var[j]
    return var

 

冒泡排序

上一篇:抄的..


下一篇:Gson