public ListNode detectCycleOld(ListNode head) {
		if (head == null)
			return null;
		ListNode fast = head;
		ListNode slow = head;
		HashSet<ListNode> set = new HashSet<ListNode>();
		set.add(head);
		while (fast.next != null && fast.next.next != null) {
			if (!set.add(slow.next))
				return slow.next;
			else {
				slow = slow.next;
				fast = fast.next.next;
			}
		}
		return null;
	}