input: Write a function to implement heap sort.
  assert heapSort([4, 10, 3, 5, 1]) == [1, 3, 4, 5, 10]
  assert heapSort([12, 11, 13, 5, 6, 7]) == [5, 6, 7, 11, 12, 13]
  assert heapSort([1, 2, 3, 4, 5]) == [1, 2, 3, 4, 5]
output: def heapSort(arr):
      def heapify(arr, n, i):
          largest = i
          l = 2 * i + 1
          r = 2 * i + 2
  
          if l < n and arr[largest] < arr[l]:
              largest = l
  
          if r < n and arr[largest] < arr[r]:
              largest = r
  
          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