0

In Floyd's algorithm, everyone uses a "slow pointer" that moves to the next node per operation, and a "fast pointer" that moves to the next.next node. When they meet, we move the "slow pointer" to the beginning of the List and then move both (by one node per time) until we reach the common node again. This node will be the start of the cycle.

That works with speeds like "slow=1" and "fast=2", but can we do the same but with "fast>2"?

1 Answers1

0

This is the same question as this one:

Why increase pointer by two while finding loop in linked list, why not 3,4,5?

Short answer: you can do with fast>2 but it actually makes total runtime slower so it's not really beneficial.

You can check out the link for a detailed proof.