Python : 插入排序

def insertionSort(alist):
for index in range(1, len(alist)):
currentvalue = alist[index]
position = index

    while position > 0 and alist[position-1] > currentvalue:
        alist[position] = alist[position-1]
        position -= 1
    alist[position] = currentvalue
上一篇:C++ STL排序问题


下一篇:Python3 列表list合并的4种方法