input: def merge_sort(A, B):
      """
      Merge two sorted lists A and B into a single sorted list. The algorithm works by comparing
      the current elements of both lists and appending the smaller one to the result list, then
      moving the pointer of the list from which the element was taken to the next element. This
      continues until one of the lists is exhausted, and then the remaining elements of the
      other list are appended to the result.
      >>> merge_sort([3, 6, 8, 10, 11], [2, 5, 7, 12])
      [2, 3, 5, 6, 7, 8, 10, 11, 12]
      >>> merge_sort([1, 3, 5], [2, 4, 6])
      [1, 2, 3, 4, 5, 6]
      """
      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