input: Write a python function to implement the merge sort algorithm.
  assert mergeSort([6, 2, 5, 1, 8, 9, 0]) == [0, 1, 2, 5, 6, 8, 9]
  assert mergeSort([10, 3, 15, 7, 8, 23, 74, 18]) == [3, 7, 8, 10, 15, 18, 23, 74]
  assert mergeSort([99, 34, 2, 5, 75, 31, 44, 1]) == [1, 2, 5, 31, 34, 44, 75, 99]
output: def mergeSort(arr):
      if len(arr) <= 1:
          return arr
  
      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
  
      mid = len(arr) // 2
      left = mergeSort(arr[:mid])
      right = mergeSort(arr[mid:])
  
      return merge(left, right)