Skip to content

Instantly share code, notes, and snippets.

@Xifeng2009
Last active September 14, 2018 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xifeng2009/578bd9d566f397989ef13acc18ec4eca to your computer and use it in GitHub Desktop.
Save Xifeng2009/578bd9d566f397989ef13acc18ec4eca to your computer and use it in GitHub Desktop.
选择排序
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