input: Write a function to find the maximum element in the given array. If the array is empty, return None.
  find_max([1, 10, 50, 3, 8])==50
  find_max([-1, -2, -3, -4, -5])==-1
  find_max([10, 10, 10, 10])==10
  find_max([])==None
  assert find_max([1])==1
output: def find_max(arr):
      if not arr:
          return None
      max_val = arr[0]
      for num in arr:
          if num > max_val:
              max_val = num
      return max_val