Last active
December 13, 2015 20:58
-
-
Save sahid/4973986 to your computer and use it in GitHub Desktop.
Selction Sort in Python
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 ssort(A): | |
| if len(A) <= 1: return A | |
| i = 0 | |
| while i < len(A): | |
| imin, j = i, i | |
| while j < len(A): | |
| if A[imin] > A[j]: | |
| A[j], A[i] = A[i], A[j] | |
| imin = j | |
| j += 1 | |
| i += 1 | |
| return A |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment