Tortoise and Hare algorithm

GPTKB entity

Statements (23)
Predicate Object
gptkbp:instanceOf gptkb:algorithm
gptkbp:alsoKnownAs gptkb:Floyd's_cycle-finding_algorithm
gptkbp:category cycle detection algorithm
pointer algorithm
gptkbp:complexity O(n)
gptkbp:field computer science
gptkbp:firstPublished 1967
gptkbp:hareSpeed two steps per iteration
https://www.w3.org/2000/01/rdf-schema#label Tortoise and Hare algorithm
gptkbp:input integer sequence
linked list
gptkbp:inventedBy gptkb:Robert_W._Floyd
gptkbp:method two pointers
gptkbp:output cycle detection result
gptkbp:pointer1 turtle
gptkbp:pointer2 hare
gptkbp:spaceComplexity O(1)
gptkbp:tortoiseSpeed one step per iteration
gptkbp:usedFor cycle detection
finding cycles in sequences
linked list cycle detection
gptkbp:bfsParent gptkb:Floyd_Loop
gptkbp:bfsLayer 6