Gee, I think I could do that in one memory
location---cache the value
of the first pointer. Keep following the list, checking each address
against the cached value. If you hit 0, it terminates, otherwise if
the address matches the cached value, you have a loop.
That works only if the place you start from is part of the loop. If
there is a non-loopy part which runs into a loop, your algorithm will
compute forever when started in the non-loopy part.
Consider A->B->C->D->E->C, started at A.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B