How to check if there is a loop in a linked list
Anonymous
Use Floyd's cycle finding algorithm. Initialize two pointers, keep moving the first pointer in steps of 1 and the 2nd in steps of (say) 2; if they collide then you have a cycle
Check out your Company Bowl for anonymous work chats.