Created
April 27, 2015 02:56
-
-
Save dragstar328/498dabec05efef7f7ed7 to your computer and use it in GitHub Desktop.
アルゴリズムクイックリファレンス:選択ソート
This file contains hidden or 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 select_sort(target): | |
p = len(target) | |
for i in xrange(p - 1): | |
min = target[i] | |
t = i | |
for j in xrange(i + 1, p): | |
if target[j] < min: | |
min = target[j] | |
t = j | |
target[t] = target[i] | |
target[i] = min | |
return target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment