input: Write a function to implement the insertion sort algorithm for sorting an array of n distinct integers. If the input array is already sorted, the function should return the array as it is. If the input array is empty, the function should return an empty array.
  assert insertion_sort([5, 3, 1, 4, 2])==[1, 2, 3, 4, 5]
  assert insertion_sort([1, 2, 3, 4, 5])==[1, 2, 3, 4, 5]
  assert insertion_sort([])==[]
output: def insertion_sort(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
      return arr