Insertion Sort

# O(n**2) time | O(1) space
def insertionSort(array):
    for i in range(1,len(array)):
        j = i

        while j > 0 and array[j] < array[j-1]: 
            swap(array,j,j-1)
            j -= 1
    return array

def swap(array,m,n):
    array[m],array[n] = array[n],array[m]
insertionSort([9,5,3,7,6,8,3,9,1,0,4,3])
[0, 1, 3, 3, 3, 4, 5, 6, 7, 8, 9, 9]