Question: (f) (i) (2 marks) Write code to measure the runtime of the implemented function and show the results. Use the menus provided. menu100 has n=100,

(f)

(i) (2 marks)

Write code to measure the runtime of the implemented function and show the results.

Use the menus provided. menu100 has n=100, menu200 has n=200, menu400 has n=400, menu800 has n=800

Use ingredient 'pizza'

In [ ]:

 
menu100 = [['water'],['banana','banana','banana'],['egg']]
for i in range(95):
 menu100[0].append('water')
 
menu200 = [['water'],['banana','banana','banana'],['egg']]
for i in range(195):
 menu200[0].append('water')
 
menu400 = [['water'],['banana','banana','banana'],['egg']]
for i in range(395):
 menu400[0].append('water')
 
menu800 = [['water'],['banana','banana','banana'],['egg']]
for i in range(795):
 menu800[0].append('water')
 
#Add your runtime testing code here
 

(ii) (6 marks)

What do your results show? Does the complexity match your expectations from part (e)? Explain your answer.

Insert your explanation here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!