Question: In this problem you will add a new (generic) method to the class SinglyLinkedList in the local version of linked lists provided in the file
In this problem you will add a new (generic) method to the class SinglyLinkedList in the local version of linked lists provided in the file src/net/datastructures/SinglyLinkedList.java. The method, called moveLastToFront , has void return type and takes no arguments. It moves the last element of the list to the beginning of the list and leaves the other elements as they were. You can use a loop or recursion and helper methods to implement moveLastToFront as well as any other methods in the class. Examples List before calling moveLastToFront List after calling moveLastToFront [] [] [3] [3] [3, 9] [9, 3] [7, 3, 2] [2, 7, 3] [4, 1, 7, 2] [2, 4, 1, 7]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
