Question: 2. Write a Java method called concat for concatenating two doubly linked lists L and M, with head and tail dummy nodes, into a new

 2. Write a Java method called concat for concatenating two doubly

2. Write a Java method called concat for concatenating two doubly linked lists L and M, with head and tail dummy nodes, into a new single doubly linked list N. (In a concatenation the elements of the second list are appended to the end of those of the first list.) Lists L and M should remain unchanged. The method should work for all lists, including empty lists. The method concat should have two parameters of type DList (references to lists L and M). It should return the reference (of type DList) to the created list N. 3. Write a Java method called reverse to reverse the order of elements in a given doubly linked list. (Do not create a new list, reverse the elements in the existing list. Do not allocate any new nodes.) The method should work for all lists, including empty lists. If the list is empty the method should do nothing. The method should have one parameter of type DList (reference to the list which elements are to be reversed). The method should not return anything (return type is void)

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!