Finding a loop in a linked list — Demystify Software


One of the most common ways to detect a loop in a linked list is Floyd’s cycle finding algorithm, also known as the Tortoise and Hare algorithm. This algorithm uses two pointers that move at different speeds to determine whether a linked list has a loop, where the loop starts, and how long the loop […]

via Finding a loop in a linked list — Demystify Software

Advertisements