Puzzle: Finding if a linked list has a loop

Puzzle statement:
You are given the reference to the head of a singly linked list. Come up with an algorithm to find out if the linked list has a loop. 
Credit:  I believe I read this problem in Sedgewick's Algorithms in C book first.


Popular posts from this blog

The mysterious ORA-03111 error

Note on allocationSize parameter of @SequenceGenerator while using JPA

Creating a Collection with a single element