input: Write a function to calculate the minimum and maximum values in an array. The function should return a tuple containing the minimum and maximum values. If the array is empty, it should return `None`.
  
  def min_max(array):
      if not array:
          return None
      min_val = array[0]
      max_val = array[0]
      for val in array[1:]:
          if val > max_val:
              max_val = val
          if val < min_val:
              min_val = val
      return min_val, max_val
  
  assert min_max([1, 2, 3, 4, 5]) == (1, 5)
  assert min_max([4, 2, 1, 6, 3, 5]) == (1, 6)
  assert min_max([-1, -2, -3, -4, -5]) == (-5, -1)
  assert min_max([-2, -4, -3, 0, -1]) == (-4, 0)
  assert min_max([]) == None
output: def min_max(array):
      if not array:
          return None
      min_val = array[0]
      max_val = array[0]
      for val in array[1:]:
          if val > max_val:
              max_val = val
          if val < min_val:
              min_val = val
      return min_val, max_val