Skip to content

Instantly share code, notes, and snippets.

@wilcoln
Created March 10, 2018 19:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wilcoln/e98edd9160eecd0b6c60125ae35b758f to your computer and use it in GitHub Desktop.
Save wilcoln/e98edd9160eecd0b6c60125ae35b758f to your computer and use it in GitHub Desktop.
Python Insertion sort code
def insertion(array):
for i in range(1, len(array)):
key = array[i]
j = i-1
while(j>-1 and array[j] > key):
array[j+1] = array[j]
j-=1
array[j+1] = key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment