Created
March 10, 2018 19:16
-
-
Save wilcoln/b6e2253638d26737e0e983ba3c8da590 to your computer and use it in GitHub Desktop.
Python Selection sort code
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(array): | |
for i in range(len(array)): | |
key = i | |
for j in range(i+1, len(array)): | |
if(array[key] > array[j]): | |
key = j | |
tmp = array[i] | |
array[i] = array[key] | |
array[key] = tmp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment