Friday, April 22, 2016

Tortoise-hare algorithm

April 22, 2016

Find if a linked list has a cycle. Expectation O(n) time; O(1) space.

http://codingfreak.blogspot.com/2012/09/detecting-loop-in-singly-linked-list_22.html

https://www.quora.com/How-does-Floyds-cycle-finding-algorithm-work



No comments:

Post a Comment