Possible Duplicate:
How to determine if a linked list has a cycle using only two memory locations.
hello i have been asked in an interview that how can i find a loop exists in a link list using only two pointers.
i have done the following:
1) find the center of the link list each time
2) by iterating this at the end both the pointers will be pointing the same node if not pointing the same node and finds a null then there is no loop in link list.
is there any efficient method to do this...?
thanx in advance.