1. I know there is a cycle
2. Since via the "Hare Tortoise Algo" when the list is detected, the
fast pointer is caught in the loop, we can run it around the loop to
find the length of the cycle.

I don't know the node that has two in-pointers/element that points
backwards

Any ideas now??

I have a brute force solution like this:
Once I know the length of the loop I can try traversing this length
from all nodes beginning from the handle. The first node for which I
come back after is the node!

Thanks,
Oogle

Singularity wrote:
> Did you detect the exact element that points backwards, or you just
> know that there is a cycle somewhere in the list?
> (There is a simple and efficient algorithm to know that there is a
> cycle without detecting the exact element that points backwards)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to