13、copy-list-with-random-pointer
现在有一个这样的链表:链表的每一个节点都附加了一个随机指针,随机指针可能指向链表中的任意一个节点或者指向空。
请对这个链表进行深拷贝。
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
Return a deep copy of the list.
思路:分三步,1、复制旧链表(直接将复制的新结点放在每一个旧结点的后面),2、给新结点加上正确的random指针,3、分离新旧结点,将新结点组成的链表作为旧链表的深拷贝