Skip to content

Instantly share code, notes, and snippets.

@ehsania
Last active December 17, 2015 19:50
Show Gist options
  • Save ehsania/5663614 to your computer and use it in GitHub Desktop.
Save ehsania/5663614 to your computer and use it in GitHub Desktop.
Very simple implementation of "Insertion sort" in python
def insertion_sort(lst):
for i in xrange(1,len(lst)):
for j in xrange(0,i):
if lst[i] < lst[j]:
lst[i], lst[j] = lst[j], lst[i]
return lst
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment