Loop in single linked list

來源: 2009-05-15 07:55:51 [舊帖] [給我悄悄話] 本文已被閱讀:

Wow, 幾天不見,這裏正熱鬧,看來還是Progromers比Mathematician多。怪不得康MM被氣得離家出走了。:)
既然大家對Programing感興趣,給大家做一個。不過,哪位想Progrom也可以。
Any language is ok.

(An interview question)
Given a single linked list with n items.
Find an O(n) algorithm to detect any loops.