input: Write a function to find the maximum element in the given array. If the array is empty, return None. The function should iterate through the array and keep track of the maximum value found.
  assert find_max_element([1, 10, 50, 3, 8])==50
  assert find_max_element([])==None
  assert find_max_element([-1, -10, -50, -3, -8])==-1
  assert find_max_element([100, 200, 300])==300
  assert find_max_element([5])==5
output: def find_max_element(arr):
      if not arr:
          return None
      max_val = arr[0]
      for num in arr:
          if num > max_val:
              max_val = num
      return max_val