This exercise compares the efficiency of array-based lists (Python list implementation) and linked lists (see materials for an ad hoc implementation).

Implement a test, where the numbers 1,2,\dots,n are added to the end of a Python list one at a time. Then the last element of the list is deleted n times.

Implement the analogous stack functionality using single-linked list (using push_head and pop of the ad hoc implementation).

Implement the tests with n=10^5. Make four time measurements: How much time it takes to do all the additions and how much time to do all the deletions with the two implementations.

In this task you get a point automatically when you fill in your measurement results, your analysis on them, the code used in the test, and press the submit button.

Time for additions (Python list): s

Time for deletions (Python list): s

Time for additions (single-linked list): s

Time for deletions (single-linked list): s

Explain the likely reasons for the differences in the time measurements:

The code you used in the test: