input: Write a function to merge two sorted lists and return a single sorted list. If either list is empty, return the other list as it is.
  def merge_sorted_lists(listA, listB): 
      merged_list = []
      ptrA = 0
      ptrB = 0
      while ptrA < len(listA) and ptrB < len(listB): 
          if listA[ptrA] <= listB[ptrB]: 
              merged_list.append(listA[ptrA]) 
              ptrA += 1
          else: 
              merged_list.append(listB[ptrB]) 
              ptrB += 1
      while ptrA < len(listA): 
          merged_list.append(listA[ptrA]) 
          ptrA += 1
      while ptrB < len(listB):
          merged_list.append(listB[ptrB])
          ptrB += 1
      return merged_list
  
  assert merge_sorted_lists([2,4,6], [3,5,7])==[2,3,4,5,6,7]
  assert merge_sorted_lists([1,3,5], [2,4,6,8])==[1,2,3,4,5,6,8]
  assert merge_sorted_lists([], [3,5,7])==[3,5,7]
  assert merge_sorted_lists([2,4,6], [])==[2,4,6]
  assert merge_sorted_lists([], [])==[]
output: def merge_sorted_lists(listA, listB): 
      if not listA:
          return listB
      if not listB:
          return listA
      merged_list = []
      ptrA = 0
      ptrB = 0
      while ptrA < len(listA) and ptrB < len(listB): 
          if listA[ptrA] <= listB[ptrB]: 
              merged_list.append(listA[ptrA]) 
              ptrA += 1
          else: 
              merged_list.append(listB[ptrB]) 
              ptrB += 1
      while ptrA < len(listA): 
          merged_list.append(listA[ptrA]) 
          ptrA += 1
      while ptrB < len(listB):
          merged_list.append(listB[ptrB])
          ptrB += 1
      return merged_list