Question: I was working on a code to reverse a linked list by splitting it recursively and cant figure out the code. The image description of
I was working on a code to reverse a linked list by splitting it recursively and cant figure out the code. The image description of what the code should do is given and the WRITTEN-DESCRIPTION (very important-please read) is given above the image description. This code is supposed to be written in JAVA and is ONLY SUPPOSED TO USE THE REVERSE METHOD with only the level parameter.

3. public void reverse(int level) 130 marks] The reverse must operate recursively. First the list should be split into two lists, one with the first floor of n/2 entries and the other with the rest. You can use two new LinkedList objects each time you split the list in half but do not make any new ListNode objects. Then each of these lists should be reversed recursively. Then concatenate together the answers appropriately to get the final answer. The variable level is for debugging and represents the level of the recursive call. The initial call should be at level 0. If reverse is called from level k then the resulting invocation is at level k+1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
