dsa1 min read
Linked List Cycle — Floyds Tortoise and Hare
Detect a cycle in a linked list in O(1) space using Floyd's two-pointer tortoise and hare algorithm.
Read →
webcoderspeed.com
3 articles
Detect a cycle in a linked list in O(1) space using Floyd's two-pointer tortoise and hare algorithm.
Find the node where a cycle begins using Floyd's algorithm: detect meeting point, then reset one pointer to head.
Find the duplicate in an array of n+1 integers in O(1) space by treating indices as a linked list with Floyd's cycle detection.