Hacker News new | ask | show | jobs
by microtherion 3133 days ago
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.
1 comments

More specifically you stop moving the hare and send the tortoise around again until it meets the hare counting your steps along the way.