Glossary term

What is Floyd's algorithm (Floyd's cycle detection)?

Floyd's algorithm stands for Floyd's cycle detection.

Slow and fast pointers in a cycle: fast gains one step per round on slow, so they must meet. A second phase from the head finds where the cycle starts. It needs O(1) memory.

Learn it properly · DSALesson 36: Reverse and Fast/Slow PointersReverse a list, find the middle, and check if the list has a loop (a cycle).

All DSA terms

Related terms

← All glossary terms, A to Z