GeeksforGeeks » Linked List specific questions
Reversing doubly linked list
(5 posts)-
Give an algorithm to reverse a doubly linked list in less than linear time
-
Reversing a DLL will take O(n) time if we use normal representation (prev and next pointers) for DLL. If DLL is implemented as XOR List (http://www.geeksforgeeks.org/archives/12367), then reversing a DLL is a simple O(1) operation. we just have to swap start and pointers.
-
I'm getting a 'page not found' error clicking the link that yo have provided. Plz provide the current link
-
@kartik, Yes , swapping the head and tail pointers in an XOR DLL is an 0(constant operation) but it also also requires a complicated and bigger data structure for storing the addresses of the start/head and end/tail pointers of the XOR DLL. Thank you.
Reply
You must log in to post.