public boolean hasCycle(ListNode head) {
		ListNode fast = head;
		ListNode slow = head;
		
		// empty list or single node list is defined as no cycle
		if (fast == null || fast.next == null) return false;
		
		while (fast != null && fast.next != null) {
			slow = slow.next;
			fast = fast.next.next;
			
			if (slow == fast) return true;
		}
		
		return false;
	}