Hello everyone !
I had found a nice book in my TI classroom which is called “Introduction to Algorithms” Thomas. H Cormen. I had some time during lesson so I decided to rewrite some algorithms in python. Here you got one of these, it is called “insertion sort”. Insertion sort is a simple sorting algorithm, a comparison sort in which the sorted array (or list) is built one entry at a time.
A = [6,2,3,1,5,8,10,9,22,7] for j in range(1,len(A)): key = A[j] i = j -1 while i >= 0 and A[i] > key: A[i+1] = A[i] i = i-1 A[i+1] = key