摘要:
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.和clone graph那题差不多,使用一个map来保存已经创建好的node。第一步:先复制原始链表中的节点,用next指针链接起来,在复制节点时放入map中第二步:设置每个节点的random指针空间复杂度为O(n),时间复杂度为O(n)Accepted Co 阅读全文
posted @ 2013-10-05 15:42
feiling
阅读(855)
评论(2)
推荐(0)
浙公网安备 33010602011771号