coding-note icon indicating copy to clipboard operation
coding-note copied to clipboard

刷题笔记:LeetCode和剑指Offer等

Results 1 coding-note issues
Sort by recently updated
recently updated
newest added

陈老师: 您好!感谢您开源如此优秀的项目。 关于选择排序,我觉得在将min_index初始化为待排序数列的第1个元素后,不用再将array[min_index]与array[i]进行比较,因此我认为第二个for循环应该修改为for j in range(**i+1**, lengths);请问我的理解是否有误呢?请多多指教,谢谢! def SelectionSort(array): lengths = len(array) for i in range(lengths-1): min_index = i for j in range(**i+1**, lengths): if array[j] < array[min_index]: min_index =...