《算法圖解》第二章筆記與課後練習_選擇排序算法

軟件環境:Python 3.7.0b4 一、選擇排序 # 找出數組中的最小元素 def findSmallest(arr): # 存儲最小的值 smallest = arr[0] # 存儲最小元素的索引 smallest_index = 0 for i in range(1, len(arr)): if arr[i] < smallest: smallest
相關文章
相關標籤/搜索