Question: Python 3.x This is the Starter Code def merge(listA, listB): ''' Given 2 lists whose elements are in increasing order, merge them into one list
Python 3.x



This is the Starter Code
def merge(listA, listB): ''' Given 2 lists whose elements are in increasing order, merge them into one list of elements in increasing order :param listA: a list in increasing order :param listB: a list in increasing order :return: a list with all elements in increasing order ''' result = [] indexA = 0 indexB = 0 while indexA and indexB # step through the lists one element at a time # put the smaller element in the result if listA[indexA] else: result.append(listA[indexA]) indexB = indexB + 1 # add the remaining elements if indexA return result
Question 3 (9 points) Purpose: More practice writing test-cases and implementing test-drivers. Degree of Difficulty: Moderate In the document aBq3 functions.py you'll find the function: merge: Given 2 lists whose elements are in increasing order, merge them into one list of elements in increasing order The code is below. The idea is to step through both lists one element at a time. Compare two elements, one from each list, and put the smaller into the merged list. If you reach the end of either list, add the rest of the other list to the end of the merged result. def nerge (listA, listB) Givon 2 list whose elements ar0 in increasing ordor. nerge then into one list of elements in increasing order : param listA: a list in increasing order : param listB: a list in increasing order :return: a list vith all elenents in increasing order result -[ indexB-0 vhile indexA
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
