Question: Question22(12 marks) You are given a ListNode class and a List class: public class List Node int ListNode next; data public class List ListNode header

 Question22(12 marks) You are given a ListNode class and a List

Question22(12 marks) You are given a ListNode class and a List class: public class List Node int ListNode next; data public class List ListNode header Write a Java function Addtolist2(list_2, List 1) which adds the first element of linked lit list 1 as a last element of linked list list_2 and removes it from list 1 For example, if list 2-(5, 6,7, 8) and list 1(9, 10, 11, 12, then: Addtolist2(list_2, list_1) will change list 2 to (5, 6,7,8,9) and change list_1 to (10, 11, 12) Note that you should not create new lists in this method

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!