int findLoop (Node *head)
{
Node *slow, *fast;
slow=head;
fast=head;
while (fast!=NULL && fast->next!=NULL )
{
fast= fast->next->next;
slow = slow->next;
if (slow == fast)
{
return 1; //loop found
}
}
return 0; //No loop, reached end of list