摘要:
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 阅读全文
摘要:
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 阅读全文
摘要:
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 阅读全文