input: 
  def merge_sort(A: List[int], B: List[int]) -> List[int]:
      """ Merge two sorted lists A and B into a single sorted list. The algorithm works by comparing the 
      first elements of both lists and adding the smaller element to the result list. The pointer for the 
      list from which the element was taken is then moved to the next element. The process continues until 
      all elements from 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]
      """
  
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.extend(A[i:])
      result.extend(B[j:])
      return result