Skip to content

Instantly share code, notes, and snippets.

@vinay13
Created August 21, 2016 00:22
Show Gist options
  • Save vinay13/b6e4f1809a73571153d487e4dcc439be to your computer and use it in GitHub Desktop.
Save vinay13/b6e4f1809a73571153d487e4dcc439be to your computer and use it in GitHub Desktop.
li = [5,2,3,1,6,4]
for i in range(1,len(li)):
j = i
while j > 0 and li[j] < li[j-1]:
li[j], li[j-1] = li[j-1], li[j]
print i,j,li
j=j-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment