Hacker News new | ask | show | jobs
by simooooo 3134 days ago
"It is easy to see that they will eventually meet on the cycle. Once that happens, it is easy to count the cycle length."

Is that so?

1 comments

The second part of this confused me as well, because the algorithm only detects the existence of the cycle, not its length. However, once you know a node in the cycle (which this algorithm will provide), you simply go around the cycle once more and you have the length.
More specifically you stop moving the hare and send the tortoise around again until it meets the hare counting your steps along the way.