Question: The following exercise deal with coding a LinkedList. - The methids you are writing are instance methods inside of LinkedList, so you can use the

The following exercise deal with coding a LinkedList. - The methids you are writing are instance methods inside of LinkedList, so you can use the Node class. - The LinkedList contains a Node head and tail(optional). - The LinkedList contains a method size() that returns the number of elements in the list. - The Node objects are singly-linked, and contain public variable next, which references the next node in the list. - you can use an Iterator if you want but you dont need to.

1. Write a method called concatenate, which takes two listels, which we'll refer to as A and B, and changes A such that it has A's elements first, then B's elements. For example, if A is [1,3,5] and B is [2,4,6], concatenate changes A to [1,3,5,2,4,6].

public void concatenate (LinkedList A, LinkedList B) {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!