2

All the documentation I read on the subject explain the algorithm with a starting point outside the loop.

What if my linked list is just a giant loop and my starting point is right in the middle ??? How the algorithm will handle that ?

The turtoise and the hare will meet for sure at some point in the cycle, but how the starting point will be determined ? Since the whole list is a loop, there isn't really a starting point....

Thanks

  • 3
    Start anywhere. At some point the hare will overtake, or the turtle will have gone round at least once. – Jongware Jan 23 '15 at 20:05

0 Answers0