Question: fassttt Question 12 7 Points Write a method called CompareAndChangelist to be included in an application class called ListApplication that accepts two parameters list and
Question 12 7 Points Write a method called CompareAndChangelist to be included in an application class called ListApplication that accepts two parameters list and list of type SingleLinkedList of integer values, and a third parameter item of type int. If list and list2 are of different sizes, the method returns false, otherwise, the method replaces any element in list with a value equal to the last element in list, if the summation of the element in list and the corresponding element inst2 is equal to item. Assume list and list are not empty. If at least one replacement happened, the method returns true, otherwise it return false Note: Write this method by calling methods of the class SingleLinkedlist. Method head public static boolean Comperehrschargest singlelinkedisseinteger tiszt, Singlelinkelsteinteger lisez, int item Example: Before Method call items list1:23 26 2017 12:10 9 25 15 4 After Method call list:23 26 30 2017 list2:10 17 25 17 4 In this case the method will return true Note: as you can see the summation of 26 (in list 1) and its corresponding element in lista 35which is equal to item so we replace the element in list 2(9) by the value of the last node in Ist which is 17. The same thing is between the elements 20 in 11 and 15 din list 2.15 is going to be replaced by 17 The rest will not change use the cater to form your
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
