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