Question: To find starting node of loop if cycle exists in linked list
Approach:
(1)Using Hare-Tortoise algorithm, find if cycle exists(No issues with this step)
(2)Let P be the node where hare and tortoise meets.Let H be head pointer on linked list.Traverse one node at a time from H and P until they meet.
Doubt: Logic behind (2). How does traversing one step at a time from H and P ensure that they will meet at the start of loop?
References:
Partially Explained Logic(Refer second approach in this blog)