input: Write a function to perform merge sort on a list.
  assert mergeSort([8, 4, 6, 1]) == [1, 4, 6, 8]
  assert mergeSort([10, 3, 15, 7, 8, 23, 74, 18]) == [3, 7, 8, 10, 15, 18, 23, 74]
  assert mergeSort([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
output: def mergeSort(arr):
      if len(arr) <= 1:
          return arr
      
      mid = len(arr) // 2
      left = mergeSort(arr[:mid])
      right = mergeSort(arr[mid:])
      
      return merge(left, right)
  
  def merge(left, right):
      result = []
      i = j = 0
      
      while i < len(left) and j < len(right):
          if left[i] < right[j]:
              result.append(left[i])
              i += 1
          else:
              result.append(right[j])
              j += 1
      
      result.extend(left[i:])
      result.extend(right[j:])
      
      return result