> No. Let the hare keep the count, not the tortoise. I suggest you
> implement
> the algorithm first before discussing its performance characteristics.
I have implemented the hare-and-tortoise before. I don't think it belongs
in common list operations, whether the cost factor is my sloppy 2.5 or an
optimized 1.5. Especially as it precludes valid circular list uses, as
Andre and Shiro have pointed out.
> Plus, you don't need a hare and tortoise to perform cycle detection for
> length.
That's what I originally thought, but it only applied to "rings" like
#0=(1 2 . #0#) that Shiro mentioned. What's your optimized version?
Best,
Dan Muresan
http://alumnus.caltech.edu/~muresan
Received on Mon Oct 02 2006 - 08:18:04 UTC