Find if a linked list has a cycle in it.
Sigiloso
You can define two pointers, slow and fast. Make both of them start from the head. Advance the fast two items at a time and the slow one item at a time. If the link list is acyclic, the fast pointer will reach a NULL. If the link-list is cyclic, you will get to a point where either "fast = slow" or "fast->next = slow". This algorithm is O(n).