Detect a Cycle in a Linked List

This is one way of how to detect if a Linked List is a cyclic or not. The basic idea is to make 2 pointers to the head and then make one of them move slow (one hop at a time) and the other move faster (2 hops at a time). They will be in a loop until they collide which means there is a cycle!

 


So, what do you think ?