How to detect loop in a link list?
Anonymous
Use 2 pointers. The first is advance 1 node step, the seconds advanced 2 nodes steps each iteration. If the 2 pointers are equal than it mean loop detected.
Check out your Company Bowl for anonymous work chats.