array-based implementation of merge-sort we begin by focusing on the case when sequence of items is represented as an (array-basedpython list the merge function (code fragment is responsible for the subtask of merging two previously sorted sequencess and with the output copied into we copy one element during each pass of the while loopconditionally determining whether the next element should be taken from or the divide-and-conquer merge-sort algorithm is given in code fragment we illustrate step of the merge process in figure during the processindex represents the number of elements of that have been copied to swhile index represents the number of elements of that have been copied to assuming and both have at least one uncopied elementwe copy the smaller of the two elements being considered since objects have been previously copiedthe next element is placed in [ (for examplewhen is the next element is copied to [ ]if we reach the end of one of the sequenceswe must copy the next element from the other def merge( ) """merge two sorted python lists and into properly sized list "" = = while len( ) if =len( or ( len( and [is [ ]) [ +js [icopy ith element of as next item of + else [ +js [jcopy jth element of as next item of + code fragment an implementation of the merge operation for python' arraybased list class ij ( ij (bfigure step in the merge of two sorted arrays for which js [iwe show the arrays before the copy step in (aand after it in (