Here\'s a Python implementation of insertion sort, I tried to follow the values on paper but once the counting variable i gets bigger than len(s) I don\'t know what to do, h
def insertie(x):
nrc=0
nrm=0
for i in range(0,len(x)):
aux=x[i]
nrm=nrm+1
j=i-1
while j >= 0 and aux < x[j]:
nrc=nrc+1
x[j+1]=x[j]
nrm=nrm+1
j=j-1
nrc=nrc+1
x[j+1]=aux
nrm=nrm+1
return x
x=[7,5,4,9,1,4,0,1]
print insertie(x)