Question: 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

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!