CS312 Lab 5: Reversing a Linked List


Due Monday, March 4, at 5:00 PM

Starting with the class linked list example from last week (llist.cpp, llist.h, test.cpp) add and test a new method for the linked list called reverse. It does not take any parameters, but reverses the order of the items in the list. Make sure your algorithm is O(n), and do not move any data in memory (just changed the links).
This can be solved gracefully in a recursive manner, and feel free to do so, but it will limit the reverse mechanism to lists no longer than the number of stack frames that can be accomodated, thus being O(n) with respect to memory as well as time. It can also be solved iteratively without this issue.