input: 
  def merge_sort(A, B):
      """ Implement an algorithm to merge two sorted lists A and B. 
      Compare the first element of A with the first element of B. 
      If the element of A is smaller, it should be added to the result list 
      and the pointer of A should move to the next element. 
      If the element of B is smaller, add it to the result list and 
      move the pointer of B to the next element. Continue this process until 
      all elements of both lists are added to the result list.
      
      >>> 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
  
      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
  
  #Test the algorithm
  A = [3, 6, 8, 10, 11]
  B = [2, 5, 7, 12]
  
  print(merge_sort(A, B))
  # Output: [2, 3, 5, 6, 7, 8, 10, 11, 12]
  
output:     
      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
  