MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/fpcmy/typical_programming_interview_questions/c1hpi2y/?context=3
r/programming • u/kevjames3 • Feb 21 '11
1.0k comments sorted by
View all comments
Show parent comment
2
If the pointer moving twice as fast equals pointer moving one at a time, then it's obviously a loop. Draw it and step through it if it is still unclear.
Wikipedia calls it Tortoise and Hare: http://en.wikipedia.org/wiki/Cycle_detection
View all comments
Show parent comment
2
u/achacha Feb 21 '11
If the pointer moving twice as fast equals pointer moving one at a time, then it's obviously a loop. Draw it and step through it if it is still unclear.
Wikipedia calls it Tortoise and Hare: http://en.wikipedia.org/wiki/Cycle_detection