Detecting a loop in linked list without Floyds cycle detection algorithm
<p>In an interview I was asked to detect the loop node in the linked list and count the number of nodes in the loop. As i was unaware of the flyod algorithm, I tried to figure out my own approach. </p>

<p>The idea is in this scenario, the address of two nodes will be pointing to the same node(loop node).</p>

<p>Eg.</p>

<p>1-->2-->4-->5-->7-->3-->4</p>

<p>Here 2->next and 3->next is same, which is the address of 4. Which means there is a loop in the linked list and 4 is the loop node. And traversing from 4 to 4 will give the number of nodes in loop.</p>

<p>Is there a way we can go ahead with this approach ????</p>