|
|
|
|
|
by lmm
482 days ago
|
|
> Instead of each node storing the next- and previous-pointers separately, store a single pointer which is the XOR of the two. Which is obviously an invalid pointer. But when iterating, XOR the previous node's pointer with the combined pointer to get the next node's pointer, and so on. You can iterate this way in both directions. Feels illegal. :) Meh, it's not a pointer, it's not really any different from storing the difference between the two pointers, which obviously would let you iterate in both directions. |
|
But even so, storing a doubly linked list with only pointer differences and no absolute pointers (other than head and tail) feels illegal too