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

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.

Step by Step Solution

3.43 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Okay lets break this down The goal here is to determine whether adding a size method to a linked lis... View full answer

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 Java Programming Questions!