05 2021 档案

摘要:def insertionSort(arr): for i in range(len(arr)): preIndex = i-1 current = arr[i] while preIndex >= 0 and arr[preIndex] > current: arr[preIndex+1] = a 阅读全文
posted @ 2021-05-10 16:22 小僧回头啦 阅读(17) 评论(0) 推荐(0) 编辑
摘要:def selectionSort(arr): for i in range(len(arr)): # 记录最小数的索引 minIndex = i for j in range(i, len(arr) - 1): if arr[j] < arr[minIndex]: minIndex = j arr 阅读全文
posted @ 2021-05-10 16:11 小僧回头啦 阅读(38) 评论(0) 推荐(0) 编辑
摘要:def bubbleSort(arr): for i in range(0, len(arr)): for j in range(0, len(arr)-i-1): if arr[j] > arr[j+1]: arr[j], arr[j + 1] = arr[j + 1], arr[j] retur 阅读全文
posted @ 2021-05-10 16:09 小僧回头啦 阅读(19) 评论(0) 推荐(0) 编辑