public RandomListNode copyRandomList(RandomListNode head) {
		if (head == null) {
			return null;
		}

		RandomListNode copyHead = new RandomListNode(-1);
		RandomListNode ptr0 = head;
		RandomListNode ptr1 = copyHead;

		Map<RandomListNode, Integer> ps = new HashMap<RandomListNode, Integer>();
		RandomListNode[] nodes = new RandomListNode[100];
		int idx = 0;
		while (ptr0 != null) {
			ps.put(ptr0, idx);
			ptr1.next = new RandomListNode(ptr0.label);
			ptr0 = ptr0.next;
			ptr1 = ptr1.next;
			if (idx >= nodes.length) {
				nodes = Arrays.copyOf(nodes, nodes.length + 20);
			}
			nodes[idx] = ptr1;
			idx += 1;
		}

		copyHead = copyHead.next;

		nodes = Arrays.copyOf(nodes, idx);

		ptr0 = head;
		ptr1 = copyHead;
		while (ptr0 != null) {
			RandomListNode random = ptr0.random;
			if (random != null) {
				int i = ps.get(random);
				ptr1.random = nodes[i];
			} else {

			}
			ptr0 = ptr0.next;
			ptr1 = ptr1.next;
		}

		return copyHead;
	}