Re: [algogeeks] Double Linked List Represented With Single Linked List

2012-06-21 Thread Atul Singh
These posts will clear ur questions http://www.geeksforgeeks.org/archives/12367 http://www.geeksforgeeks.org/archives/12615 -- ATul Singh | Computer Science Engineering| 2008-12 Batch | NIT Jalandhar | 9530739855 -- You received this message because you are subscribed to the Google Groups

Re: [algogeeks] Double Linked List Represented With Single Linked List

2012-06-21 Thread Amitesh Singh
Krishna, how can you store a address pointing to k bits value into k/2 bits? XOR is the way to do this. -- Amitesh On Thu, Jun 21, 2012 at 1:20 AM, Krishna Kishore kknarenkris...@gmail.comwrote: *np *is nothing but *next_pointer. np[x] *does mean *x-np *which is the next pointer to

[algogeeks] Double Linked List Represented With Single Linked List

2012-06-20 Thread Krishna Kishore
Explain how to implement doubly linked lists using only one pointer value*np[x *] per item instead of the usual two (next and prev). Assume that all pointer values can be interpreted as k-bit integers, and define* np[x] to be np[x] = next[x] XOR prev[x],* the k-bit “exclusive-or” of next[x] and

Re: [algogeeks] Double Linked List Represented With Single Linked List

2012-06-20 Thread adarsh kumar
Simple! Just traverse the doubly linked list and keep track of next and previous of each node, and do XOR and save the result in a new pointer, what according to you is np. Be careful about boundary cases, i.e head and tail, though. On Wed, Jun 20, 2012 at 5:16 PM, Krishna Kishore

Re: [algogeeks] Double Linked List Represented With Single Linked List

2012-06-20 Thread Krishna Kishore
*np *is nothing but *next_pointer. np[x] *does mean *x-np *which is the next pointer to node. Actually I am thinking in this way about *np, *that it stores the *XOR* value of *next* and *prev* pointers.Or Since *np *is a k-bit integer, the first k/2 bits wil be used for *next*, and other k/2