Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions