Skip to content

Instantly share code, notes, and snippets.

@koehlma
Created October 26, 2014 09:37
Show Gist options
  • Save koehlma/1e6011df8f03ecc20fa4 to your computer and use it in GitHub Desktop.
Save koehlma/1e6011df8f03ecc20fa4 to your computer and use it in GitHub Desktop.
def insertionsort(liste):
counter = 0
for i in range(1, len(liste)):
x, j = liste[i], i
while j > 0:
counter += 1
if not liste[j - 1] > x: break
liste[j] = liste[j - 1]
j -= 1
liste[j] = x
return counter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment