Skip to content

Instantly share code, notes, and snippets.

@sahid
Last active December 13, 2015 20:58
Show Gist options
  • Select an option

  • Save sahid/4973986 to your computer and use it in GitHub Desktop.

Select an option

Save sahid/4973986 to your computer and use it in GitHub Desktop.
Selction Sort in Python
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