you can find explanation of same problem at http://code-forum.blogspot.com/2010/12/loop-in-linked-list.html
On Dec 22 2010, 8:41 pm, Saurabh Koar <saurabhkoar...@gmail.com> wrote: > Finding whether a loop exists or not in a linked list, is a very > familiar problem.But I want an algorithm that will find the node that > is causing the loop. > Well,I have an approach.Start from the head.Copy its data into an > array.Mark node's data as infinity.Move to the next node.When u find > node->next->data=infinity u will say that the current node is causing > the loop.Then restore the data of the linked list from the array.But I > think more optimized algorithm is possible.Reply if you know more > optimized way. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.