Cute algorithms dilemma: can you determine if a linked list loops back on itself or if it terminates using only two pointers?

The answer is deceptively simple. Set both pointers to the head of the list. Then, iterate through the list, advancing the first pointer two nodes for every one node you advance the second pointer. On each iteration, compare the pointers against each other and against null. The list loops if the pointers are ever equal; it does not loop if either of the pointers is ever null.

As an extra bonus, it's an O(n) algorithm.