Skip to content

Instantly share code, notes, and snippets.

@ngenator
Created August 8, 2013 00:19

Revisions

  1. ngenator created this gist Aug 8, 2013.
    10 changes: 10 additions & 0 deletions selectionsort.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    def selection_sort(to_sort):
    for i in range(len(to_sort) - 1):
    minimum = i
    for j in range(len(to_sort) - 1):
    if to_sort[j] < to_sort[minimum]:
    minimum = j
    temp = to_sort[i]
    to_sort[i] = to_sort[minimum]
    to_sort[minimum] = temp
    return to_sort