public RandomListNode copyRandomList(RandomListNode head) {
        // write your code here
        if (head == null)
            return null;
        RandomListNode ptr = head;
        // copy all the node of head
        while (ptr != null) {
            RandomListNode newNode = new RandomListNode(ptr.label);
            RandomListNode next = ptr.next;
            ptr.next = newNode;
            newNode.next = next;
            ptr = next;
        }
        // mark the random pointer
        ptr = head;
        RandomListNode copy = ptr.next;
        while (ptr != null) {
            RandomListNode random = ptr.random;
            if (random != null)
                copy.random = random.next;
            ptr = copy.next;
            if (ptr != null)
                copy = ptr.next;
        }
        // break the link
        ptr = head;
        copy = ptr.next;
        RandomListNode res = copy;
        while (ptr != null) {
            RandomListNode next = copy.next;
            ptr.next = next;
            ptr = ptr.next;
            if (next != null) {
                copy.next = next.next;
                copy = copy.next;
            }
        }
        return res;
    }