Tag Archives: warshall

Finding loop in a singly linked-list

You can detect it by simply running two pointers through the list. Start the first pointer p1 on the first node and the second pointer p2 on the second node. Advance the first pointer by one every time through the loop, advance … Continue reading

Posted in Algorithms, Interview Puzzles | Tagged , , , | Leave a comment