Two pointers will meet at k nodes from start of the cycle in a linked list?
Two pointers, one that moves at normal speed, n, and one that moves at 2n,
will meet at a point k nodes from the start of the cycle in the linked
list, where k = length of cycle - number of nodes before the beginning of
the cycle.
Can someone please explain how you can reach this conclusion?
No comments:
Post a Comment