input: def merge_sort(A, B):
      """
      Merges two sorted lists A and B into a single sorted list by comparing their elements.
      If the current element of A is less than the current element of B, it is added to the result list,
      and the pointer for A is moved to the next element. Otherwise, the element of B is added to the result list,
      and the pointer for B is moved to the next element. This process continues until one of the lists is exhausted, 
      at which point the remaining elements of the other list are appended to the result.
      
      >>> A = [3, 6, 8, 10, 11]
      >>> B = [2, 5, 7, 12]
      >>> merge_sort(A, B)
      [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