To copy a linked list. Every node's prev points to the previous node, but the next points an arbitrary node.
Anonymous
Insert a copy of each node after the node it's copying, so the list looks like this: Node1.next -> Node1cpy.next -> Node2.next->Node2cpy.next, Then basically you make two more passes, one two nodes at a time looking like this: Node1.next->arbitrary = Node1.arbitrary->next; Then split the lists: Node1.next = Node1.next->next; Node1Cpy.next = Node1Cpy.next->next;
Check out your Company Bowl for anonymous work chats.