You are viewing a single comment's thread. Return to all comments →
def insertionSort1(n, arr): l=arr.pop(-1) rev=arr[::-1] k=arr count=0 for i in rev: if i > l: inx=k.index(i) k.insert(inx+1,i) print(*k) k.remove(i) count+=1 if len(rev)== count: k.insert(0,l) print(*k) break else: if i < l: inx=k.index(i) k.insert(inx+1,l) print(*k) break
Seems like cookies are disabled on this browser, please enable them to open this website
Insertion Sort - Part 1
You are viewing a single comment's thread. Return to all comments →