""" Data,
    function headers and specifications,
    function merge (to be used with mergesort)
    """


tomatoe= [75, 66, 62, 89, 89, 3, 26, 82]

title= ['Zathura', 'Zero Effect', 'Zoolander', 'Zombieland',
'Zodiac', 'Zoom', 'The Legend of Zorro', 'The Mask of Zorro']



def indexOfMin(y,iStart):
    """ Returns: index of min value in fragment of y starting at index iStart
    Preconditions: y is a list of numbers (ints, floats) and y[iStart:] is
    not an empty list, i.e., iStart is an int and 0 <= iStart <= len(y).
    """
    pass


def selectionSort(y):
    """ Modifies list y such that it is sorted in ascending order
    Precondition: y is a list of numbers (ints, floats)
    """
    pass


def mergeSort(y):
    """ Modifies list y such that its elements are in ascending order.
    Precondition: y is a list of numbers (ints, floats)
    """
    pass


def merge(y,L,R):
    """ Overwrite y with list elements of L and R combined in ascending order.
    Preconditions:  Lists L and R are each sorted in ascending order.
                    Length of list y is the combined length of lists L and R.
    YOU DO NOT NEED TO UNDERSTAND THIS FUNCTION!  It uses while-loops, which
    you have NOT learned yet.
    """
    iy=0
    iL=0
    iR=0
    # Copy elements from L and R to y, maintaining ascending order
    while iL<len(L) and iR<len(R):
        if L[iL] < R[iR]:
            y[iy]= L[iL]
            iL+=1
        else:
            y[iy]= R[iR]
            iR+=1
        iy+=1
    # Deal with any elements left over in L or R from above loop
    while iL<len(L):
        y[iy]= L[iL]
        iL+=1
        iy+=1
    while iR<len(R):
        y[iy]= R[iR]
        iR+=1
        iy+=1
