input: Write a function that takes two lists, A and B, and merges them together into one sorted list. The function should compare the elements of A and B one by one, starting from the first element of each list. If an element from A is smaller, it should be added to the result list and the pointer for A should move to the next element. Otherwise, if an element from B is smaller, it should be added to the result list and the pointer for B should move to the next element. After one of the lists is fully traversed, the remaining elements from the other list should be appended to the result list.
  
  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
  
  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, 3, 5], [2, 4, 6]) == [1, 2, 3, 4, 5, 6]
  assert merge_sort([], [1, 2, 3]) == [1, 2, 3]
  assert merge_sort([1], []) == [1]
  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