🎉 October Learning Month — learn a new software term every day!
An interactive flashcard trainer for software engineering terms.

Floyd Cycle

In plain terms

A two-pointer method to detect cycles using fast and slow pointers.

Going deeper

Floyd's tortoise-and-hare algorithm advances one pointer twice as fast as another; if they meet, there's a cycle. It uses constant memory.

Under the hood

O(n) time, O(1) space; also finds the cycle's start and length.

Examples

Linked-list cycle detection, finding loops, duplicate-number problems.

Think of it like...

Like two runners on a loop track: the faster one eventually laps and meets the slower if the track is circular.

Feedback & Bug Report