Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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. :) image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions