# Write a function to perform insertion sort on an arary

## Topic: Write a function to perform insertion sort on an arary

Solution

def sort_insertion(arr): for i in range(1, len(arr)): tmp = arr[i] j = i while (j > 0) & (tmp < arr[j - 1]): arr[j] = arr[j - 1] j = j - 1 arr[j] = tmp return arr

List all Python Programs