python冒泡排序

来源:互联网 发布:战舰世界腓特烈数据 编辑:程序博客网 时间:2024/06/06 07:43
def bubbleSort(list):    for i in range(len(list)-1,0,-1):        for j in range(0, i):            if list[j] > list[j+1]:                list[j],list[j+1] = list[j+1],list[j]    return listprint bubbleSort([1, 4, 9, 13, 34, 26, 10, 7, 4])

0 0