A malformed linked list might link a->b->c->d->e->c->d->e->c->d->e... How can one write a method to detect such a problem? One way is to mark each node as visited, and see if a node has been visited more than once. This might not be possible or practical depending on the space needs. Another algorithm is to have a tortoise and a hare. The tortoise steps through one at a time, but the hare does two, e.g. current=current.next; if (current!=null) current=current.next; The hare starts out ahead of the tortoise, but if there is a loop, the hare laps the tortoise, and they are guaranteed to land on the same simultaneous spot. Assume that a list as a period P. After some prelimary distance a, the hare is somewhere in the loop. After some prelimary distance b, the tortoise is somewhere in the loop. So when are they equal? when a+2*t is equivalent to b+t modulo P so within the starting distance plus the P period of the loop, the hare will lap the tortoise.