From Cracking the Coding Interview, there is an exercise that says:
Given a circular linked list, implement an algorithm that returns the node at the beginning of the loop.
Definition of circular linked list: A (corrupt) linked list in which a node's next pointer points to an earlier node, so as to make a loop in the linked list.
The algorithmic answer is basically using a slow and fast runner to iterate through the linked list to see if it loops. If the slow and fast runner collide, it loops, so then you find the node at the beginning of the loop. (If they don't collide, then the fast runner will eventually reach the end of the linked list, meaning there is no cycle.)
But the book's answer for finding where the node at the beginning of the loop is relies on the ASSUMPTION that the linked list has a "non-looped" part of size k. Once the slow and fast runners collide, you move the slow runner to the head of the linked list. You iterate both at the same speed until they collide. Where they collide is the node at the beginning of the loop.
My question is, is it possible to find where the node at the beginning of the loop is WITHOUT assuming the linked list has a "non-looped" part of size k? Or do I have to assume that there is a "non-looped" part of size k?