Computer Science, asked by opf06640, 10 months ago

write the program of insertion sort for python pls
I WILL MARK BRAINLIST for sure

Answers

Answered by adishsaju
1

def insertionSort(arr):  

   for i in range(1, len(arr)):  

       key = arr[i]  

       j = i-1

       while j >=0 and key < arr[j] :  

               arr[j+1] = arr[j]  

               j -= 1

       arr[j+1] = key

   print (arr)

Hope this helps..............

Similar questions