Declare the reverse function as follow: void reverse();
The function reverses the order of the nodes held by the linked list. This function can be implemented in several ways. The easiest way is to create a new linked list with the values from the original linked list (in reverse order). Then you could substitute the new list for the old list with a statement like head = newList; It is more challenging to reverse the list "in place" without creating any new nodes. Change main.cpp to reverse the list and the display the reversed list.
About Cramster | Terms of Use | Privacy Policy | Contact Us | Press Room | Site Map | Support | Anti-Cheating Policy