Skip to content

Instantly share code, notes, and snippets.

@cou929
Created October 3, 2010 07:57
Show Gist options
  • Save cou929/608388 to your computer and use it in GitHub Desktop.
Save cou929/608388 to your computer and use it in GitHub Desktop.
A = [5, 2, 4, 6, 1, 3]
for j in range(1, len(A)):
key = A[j]
i = j - 1
while i >= 0 and A[i] > key:
A[i+1] = A[i]
i -= 1
A[i+1] = key
print A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment