Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

from timeit import timeit from linked_list import LinkedList NUM_TRIALS = 3000 # The number of trials to run. SIZES = [1000, 2000, 4000, 8000, 16000]

from timeit import timeit from linked_list import LinkedList

NUM_TRIALS = 3000 # The number of trials to run. SIZES = [1000, 2000, 4000, 8000, 16000] # The list sizes to try.

def profile_len(list_class: type, size: int) -> float: """Return the time taken to call len on a list of the given class and size.

Precondition: list_class is either list or LinkedList. """ # TODO: Create an instance of list_class containing 0's. my_list = ...

# TODO: call timeit appropriately to check the runtime of len on the list. return 0.0

if __name__ == '__main__': for list_class in [LinkedList]: # Try each list size for s in SIZES: time = profile_len(list_class, s) print(f'[{list_class.__name__}] Size {s:>6}: {time}')

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

Understand the different approaches to job design. page 167

Answered: 1 week ago