input: 
  def merge_sort(A, B):
      """ Implement an algorithm for merging two sorted lists A and B. The algorithm should 
      compare the first element of A with the first element of B. If the element in A is 
      greater, it should add the element from B to the result list and move the pointer of B 
      to the next element. If the element in A is smaller, the pointer should move to the next 
      element of A, and so on. After reaching the end of either list, append the remaining 
      elements of the other list to the result.
      
      >>> merge_sort([3, 6, 8, 10, 11], [2, 5, 7, 12])
      [2, 3, 5, 6, 7, 8, 10, 11, 12]
      """
      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
  
output:     
      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
  