Last active
September 14, 2018 03:14
-
-
Save Xifeng2009/578bd9d566f397989ef13acc18ec4eca to your computer and use it in GitHub Desktop.
选择排序
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def selection_sort(list2): | |
for i in range(0, len (list2)-1): | |
min_ = i | |
for j in range(i + 1, len(list2)): | |
if list2[j] < list2[min_]: | |
min_ = j | |
list2[i], list2[min_] = list2[min_], list2[i] # swap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment