Download this Python file containing a series of functions. For each function, labelled parts a) through f), explain what the function does, and gives its best and worst case running times in big-O notation. Use n as the length of myList.

# a)

def partA(myList):

if len(myList) < 2:

return -1

return myList[0] + myList[1]

# b)

def partB(myList):

if len(myList) % 2 == 0:

partA(myList) + partA(myList)

else:

partA(myList)

#c)

def partC(myList):

max = myList[0]

for value in myList:

if value max:

max = value

print(max)

min = myList[0]

for value in myList:

if value < min:

min = value

print(min)

sum = 0

for value in myList:

sum = sum + value

print(sum)

#d)

def partD(myList):

i = 1

while i < len(myList):

print(myList[i])

i = 2*i

#e)

def partE(myList, valueToFind):

for i in range(len(myList)):

if myList[i] == valueToFind:

return i

return -1

#f)

def partF(myList):

products = []

for value1 in myList:

for value2 in myList:

products.append(value1*value2)

sum = 0

for product in products:

sum = sum + product

return sum

Academic Honesty!

It is not our intention to break the school's academic policy. Projects posted are only used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.

Kindly fill out the form.
Please provide a valid email address and we'll get back to you in less than 24 hours.
We will be sending an invoice through PayPal upon confirmation.
We are a non profit organization however we need an amount to keep this organization running,
and to be able to complete our research and development.