Proof of detecting the start of cycle in linked list [duplicate]
If you represent a list by a pointer to its first node (list) The algorithm to detect loops is described as follows: Declare two pointers (pFast) and (pSlow). Make pSlow and pFast point to list. Until (pSlow), (pFast) or both point to NULL: If , then STOP as a loop has just been found. If … Read more