Question: In Java Problem 2 (40 pts): Given a singly linked list with 3k elements, where k is a positive integer, write a program named ReverselistGroup
Problem 2 (40 pts): Given a singly linked list with 3k elements, where k is a positive integer, write a program named ReverselistGroup that reverse the singly linked list in this order: evenly divide the original singly linked list into k groups, which means three elements are considered as one group, then reverse the order of elements in each group. You may create a linked list to test your method. An example is shown in the following diagram. For example: Example: 12 elements are divided into 4 groups Output: 9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
