Given the size method of Exercise E16.6 and the get method of Exercise P16.1, what

Question:

Given the size method of Exercise • E16.6 and the get method of Exercise • P16.1, what is the big-Oh efficiency of this loop:

image text in transcribed

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.

Data from exercise P16.1

Add methods Object get(int n) and void set(int n, Object newElement) to the LinkedList class. Use a helper method that starts at first and follows n links:

image text in transcribed

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

Step by Step Answer:

Related Book For  answer-question
Question Posted: