01_冒泡排序

def bubble_sort(data):

'''

冒泡排序

    :paramdata:

    :return:

'''

    length =len(data)

    for i in range(length -1):

        for j in range(length - i -1):

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

                data[j], data[j +1] = data[j +1], data[j]

    return data

你可能感兴趣的:(01_冒泡排序)