Description:
Given a linked list,performs the following task
- Remove alternative nodes from second node
- Reverse the removed list.
- Append the removed list at the end.
Input :
You have to complete the method which takes oneargument: the head ofthe linked list. You should not read any input fromstdin/console.
The struct Node has a data part which stores the data and a nextpointer which points to the next element of the linked list.
There are multiple test cases. For each test case, this method will becalled individually.
Output:
You should not print any output to stdin/console
Example:
Input List: 1->2->3->4->5->6
After step 1 Linked list are 1>3->5 and 2->4->6
After step 2 Linked list are 1->3->5 abd 6->4->2
After step 3 Linked List is1->3->5->6->4->2
Output List: 1->3->5->6->4->2
Note:If you use “Test” or “Expected Output Button” use below example format