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.

Comments

Popular posts from this blog

Gotchas with DBCP

A note on Java's Calendar set() method

The mysterious ORA-03111 error