- Mar 22, 2004
- 138
- 0
- 0
I have a class assignment and one of the algorithms we are to provide in our Doubly Linked List class is a reverse() function that will reverse the list in O(1) time. Just wondering how exaxctly that can be done?
Obviously O(N) would be simple (reversing each next and prev pointer) but I'm not too sure about doing it in a constant time
Any hints or help would be appreciative
Obviously O(N) would be simple (reversing each next and prev pointer) but I'm not too sure about doing it in a constant time
Any hints or help would be appreciative