Some error occured while loading page for you. Please try again.
This challenge is part of a tutorial track by MyCodeSchool
You’re given the pointer to the head node of a doubly linked list. Reverse the order of the nodes in the list. The head node might be NULL to indicate that the list is empty.
You have to complete the Node* Reverse(Node* head) method which takes one argument - the head of the doubly linked list. You should NOT read any input from stdin/console.
Node* Reverse(Node* head)
Change the next and prev pointers of all the nodes so that the direction of the list is reversed. Then return the head node of the reversed list. Do NOT print anything to stdout/console.
NULL <-- 2 <--> 4 <--> 6 --> NULL
NULL <-- 6 <--> 4 <--> 2 --> NULL
1. Empty list, so nothing to do.
2. 2,4,6 become 6,4,2 o reversing in the given doubly linked list.