插入排序的python实现
def sort(arr): count = len(arr) for i in range(1, count): j = i while j > 0 and arr[j-1] < arr[j]: arr[j-1], arr[j] = arr[j], arr[j-1] j -= 1 return arrl = [5, 2, 7, 8, 6, 1, 4, 9, 10, 1, 2, 3, 4]print(sort(l))
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。