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.