Question: Answer in Java please. :) 3. Write a new method for the Linkedlist class named prependToList that accepts one parameter of type Linkedlist named otherlist.
Answer in Java please. :)
3. Write a new method for the Linkedlist class named prependToList that accepts one parameter of type Linkedlist named otherlist. This method must prepend (add to the front of the existing list) all items in otherlist to the beginning of this list, so that this list now contains all the items it originally contained, preceded by the contents of otherlist, which should remain unchanged. Your method must run in CONSTANT time (that's O(1)), no matter how big either list is. Use the version of the Linkedlist class developed in Lab #5 (with first and last pointers) for this problem. / 4 points */
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
