input: Write a function to implement an algorithm that sorts two large lists A and B. The function should take the first element of list A and compare it with the first element of list B. If the element of A is greater, it should add the element to the result list and move the pointer of B to the next element. If the element of A is smaller, the pointer should move to the next element of A, and so on. If either list is exhausted, the remaining elements of the other list should be appended to the result.
  def merge_sort(A, B):
   result = [] 
   i, j = 0, 0
  
   # Compare elements and add lower one to result
   while i < len(A) and j < len(B):
   if A[i] < B[j]:
   result.append(A[i])
   i += 1
   else:
   result.append(B[j])
   j += 1
  
   # Add remaining elements
   result += A[i:]
   result += B[j:]
  
   return result
  
  assert merge_sort([3, 6, 8, 10, 11], [2, 5, 7, 12]) == [2, 3, 5, 6, 7, 8, 10, 11, 12]
  assert merge_sort([], [1, 2, 3]) == [1, 2, 3]
  assert merge_sort([1, 3, 5], []) == [1, 3, 5]
  assert merge_sort([1, 2, 3], [4, 5, 6]) == [1, 2, 3, 4, 5, 6]
  assert merge_sort([], []) == []
output: def merge_sort(A, B):
   result = [] 
   i, j = 0, 0
  
   while i < len(A) and j < len(B):
   if A[i] < B[j]:
   result.append(A[i])
   i += 1
   else:
   result.append(B[j])
   j += 1
  
   result += A[i:]
   result += B[j:]
  
   return result