Show that the introduction of the size method in Exercise E16.6 does not affect the big-Oh

Question:

Show that the introduction of the size method in Exercise • E16.6 does not affect the big-Oh efficiency of the other list operations.

Data from exercise E16.6

Add an instance variable currentSize to our implementation of the LinkedList class.
Modify the add, addLast, and remove methods of both the linked list and the list iterator to update the currentSize variable so that it always contains the correct size. Change the size method of Exercise • E16.4 so that it simply returns the value of currentSize.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question
Question Posted: