public static <T> boolean ifHasLoop(MyListNode<T> head) {
		//One pointer advances once at each step, 
		// and the other advances twice at each step. 
		// If the faster pointer meets the slower one again, 
		// there is a loop in the list. 
		// Otherwise, there is no loop if the faster one reaches the end of list.
		if(head == null) {
			return false;
		}

		MyListNode<T> first = head;
		MyListNode<T> next = head;
		
		while(next!=null && (first==head || first!=next)) {
			first = first.next;
			if(next.next != null) {
				next = next.next.next;
			} else {
				return false;
			}
		}
		
		if(next == null) {
			return false;
		} else {
			return true;
		}
	}