I think the proof is not the generalised , we have done the proof by taking an example in which fast pointer moves 2y
distance but it may be possible that the fast pointer moves more than 2y distance like (3y,5y… ) that time our x will not be equal to z. plz explain?
Floyd Cycle(Linked List)
@Shivam_singh proof is as follow
slow covered x+y
fast covered x+y+z+y
now 2*slow=fast ( as speed double)
2x+2y=x+y+z+y
x+y=z+y
gives x=z hence proved
hope its clear if yes dont forget to hit like and mark resolved 
what wlll happen if in some example
fast covered x+2y+2z
slow covered x+y
2x+2y = x+2y+2z
x=2z
here x is not equal to z.
?
@Shivam_singh fast will always cover x+2y+z
try for any example by calculating fast and slow distance and doing 2xslow=fast x=z will come every time
1 Like
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
