def insertionSort(array):
# Write your code here.
for i in range(1,len(array)):
j=i
while j>0 and array[j]<array[j-1]:
swap(j,j-1,array)
j-=1
return array
def swap(i,j,array):
array[i],array[j]=array[j],array[i]
#TC=O(n^2) SC = O(1) - Saipavan Seelamsetty
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)