@@ -0,0 +1,1301 @@
+/**%0A * Definition for singly-linked list with a random pointer.%0A * class RandomListNode %7B%0A *     int label;%0A *     RandomListNode next, random;%0A *     RandomListNode(int x) %7B this.label = x; %7D%0A * %7D;%0A */%0Apublic class Solution %7B%0A    public RandomListNode copyRandomList(RandomListNode head) %7B%0A        RandomListNode p = head;%0A        if (p == null) %7B%0A            return null;%0A        %7D%0A        %0A        // make copies and chain them interleavely with original node%0A        while(p != null) %7B%0A            RandomListNode temp = new RandomListNode(p.label);%0A            temp.next = p.next;%0A            temp.random = p.random;%0A            p.next = temp;%0A            p = p.next.next;%0A        %7D%0A        %0A        //update random pointer of new nodes%0A        p = head;%0A        while(p != null) %7B%0A            p = p.next;%0A            if(p.random != null) %7B %0A                p.random = p.random.next;%0A            %7D%0A            p = p.next;%0A        %7D%0A        %0A        // split to two lists%0A        p = head;%0A        RandomListNode newList = p.next;%0A        RandomListNode q;%0A        while(p != null) %7B%0A            q = p.next;%0A            p.next = q.next;%0A            p = p.next;%0A            if (q.next != null) %7B%0A                q.next = q.next.next;%0A            %7D%0A        %7D%0A        %0A        return newList;%0A    %7D%0A%7D%0A

Create copy-list-with-random-pointer.java