input: Write a function to perform heap sort on a list of numbers.
  assert heap_sort([4, 10, 3, 5, 1]) == [1, 3, 4, 5, 10]
  assert heap_sort([12, 11, 13, 5, 6, 7]) == [5, 6, 7, 11, 12, 13]
  assert heap_sort([1, 2, 3, 4, 5, 6]) == [1, 2, 3, 4, 5, 6]
output: def heap_sort(arr):
      def heapify(arr, n, i):
          largest = i
          left = 2 * i + 1
          right = 2 * i + 2
  
          if left < n and arr[i] < arr[left]:
              largest = left
  
          if right < n and arr[largest] < arr[right]:
              largest = right
  
          if largest != i:
              arr[i], arr[largest] = arr[largest], arr[i]
              heapify(arr, n, largest)
  
      n = len(arr)
  
      for i in range(n // 2 - 1, -1, -1):
          heapify(arr, n, i)
  
      for i in range(n - 1, 0, -1):
          arr[i], arr[0] = arr[0], arr[i]
          heapify(arr, i, 0)
  
      return arr