Concept Flow - Detect Cycle in Linked List Floyd's Algorithm
Start: slow=head, fast=head
Move slow by 1 step
Move fast by 2 steps
Check if fast or fast.next is null?
Yes→No cycle, return false
No
Check if slow == fast?
Yes→Cycle detected, return true
↩Back to Move slow by 1 step
The algorithm uses two pointers moving at different speeds to detect if a cycle exists by checking if they meet.
