How do you detect a cycle in a singly linked list?
Anonymous
use the tortoise and hare method. Slow pointer should move one tile at a time and the fast pointer moves two tiles. If the fast pointer catches up to the slow pointer then there is a cycle but if the fast pointer reaches null, there is no cycle.
Check out your Company Bowl for anonymous work chats.