Google:
An XOR linked list is a more memory efficient doubly linked list. Instead of each node holding next and prev fields, it holds a field named both, which is an XOR of the next node and the previous node. Implement an XOR linked list, it has an add(element) which adds the elemnt to the end, and a get(index) which returns the node at index.
题目分析:
所谓的异或链表,就是指又链表的前指针和后指针变成了一个。它是前一个元素和后一个元素地址的异或。这即考察了链表的操作,又涉及到了逻辑操作,使得题目的难度上升。
我们先来看异或操作,异或,即相异为1,相同为0
这些结论就很有意思了