Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 45s1 days 16 hours 1 minutes 45 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 45s1 days 16 hours 1 minutes 45 seconds.

Sign in to watch this lesson
Algorithms - Linear Data Structures · 4:17
A list whose last pointer leads back inside itself never reaches null. Floyd's tortoise and hare race on the rho 0 to 7 (tail 3, loop 5) and meet at node 5; the equation a = L - b then says that restarting one runner at the head and stepping both once lands them together on the entry, node 3, and one more lap gives the loop length. The same O(1)-memory trick works on any sequence x -> f(x): Find the Duplicate, and a pseudo-random generator measured on this Mac against a hash map of first visits.