Is it possible to create a doubly linked list usinfg one pointer?
Answers
Answered by
0
Yes, possible by storing XOR of addresses of previous and next nodes.
We can traverse the XOR list in both forward and reverse direction. While traversing the list we need to remember the address of the previously accessed node in order to calculate the next node’s address.
So we have the address of next node. Similarly we can traverse the list in backward direction.
Similar questions