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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s