# -*- coding:utf-8 -*-
# class RandomListNode:
# def __init__(self, x):
# self.label = x
# self.next = None
# self.random = None
class Solution:
# 返回 RandomListNode
def Clone(self, pHead):
# write code here
if not pHead:
return None
head=pHead
while head:
cur =RandomListNode(head.label)
cur.next=head.next
head.next=cur
head=cur.next
head=pHead
while head:
if head.random:
head.next.random=head.random.next
head=head.next.next
head =pHead
nhead=pHead.next
while head.next:
tem=head.next
head.next=tem.next
head=tem
return nhead