You are asked to implement the following private and static methods. These metho
ID: 3724327 • Letter: Y
Question
You are asked to implement the following private and static methods. These methods are added to the class SingleLinkedList. Unless otherwise stated, you may freely copy the list provided as argument. Also, you may use helper methods if you feel the need to. Please use java to answer this
Exercise 11 Node removeAdjacentDuplicates (Node node). Eg. Given [1,2,2,1,3,3,3] t should return [1,2,1,3] Exercise 12 Node filterEven(Node node) removes all odd numbers. Eg. Given 1,2,3,4,5] it should return 2,4 Exercise 13 Node zipL (Node 11, Node 12). Eg. Given , 3, 5] and [2, 4, 6]), it should return [1, 2, 3, 4, 5, 6]. Provide a solution in which a new list is constructed. Then provide another solution where the two given lists are "weaved" appropriately.Explanation / Answer
Please find the required program and its output below:
--------------------------------------------
OUTPUT:
removeAdjacentDuplicates : Node[1] -> Node[2] -> Node[1] -> Node[3] -> null
filterEven : Node[2] -> Node[4] -> null
zipL : Node[1] -> Node[2] -> Node[3] -> Node[4] -> Node[5] -> Node[6] -> null
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.