Here is the problem, it is from Sedgwick\'s excellent Algorithms in Java (q 3.54)
Given a link to a node in a singly linked list that contains no null links (i.e. ea
The most elegant solution is Floyd's cycle-finding algorithm: http://en.wikipedia.org/wiki/Cycle_detection#Tortoise_and_hare
It runs in O(N) time, and only constant amount of memory is required.