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
k=1# def insertionsort(a): # should be written before k=1
c=a[:]
def swap(k,c,a):
if c[k-1] > c[k]:
c[k-1] = a[k]
c[k] = a[k-1]
a = c[:]
if max(c[:k])!= c[k-1]:
swap(k-1,c,a)
if k < len(a)-1:
return swap(k + 1, c,a)
return c
return swap(k,c,a)
print(insertionsort(b))